| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """Tests for gs_utils.py. | 3 """Tests for gs_utils.py. |
| 4 | 4 |
| 5 TODO(epoger): How should we exercise these self-tests? See http://skbug.com/2751 | 5 TODO(epoger): How should we exercise these self-tests? See http://skbug.com/2751 |
| 6 """ | 6 """ |
| 7 | 7 |
| 8 # System-level imports. | 8 # System-level imports. |
| 9 import logging |
| 9 import os | 10 import os |
| 10 import posixpath | 11 import posixpath |
| 11 import random | 12 import random |
| 12 import shutil | 13 import shutil |
| 13 import sys | 14 import sys |
| 14 import tempfile | 15 import tempfile |
| 15 import time | 16 import time |
| 16 | 17 |
| 17 # Local imports. | 18 # Local imports. |
| 18 import gs_utils | 19 import gs_utils |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 assert file_contents == 'contents of %s\n' % filename, ( | 349 assert file_contents == 'contents of %s\n' % filename, ( |
| 349 '%s == "contents of %s\n"' % (file_contents, filename)) | 350 '%s == "contents of %s\n"' % (file_contents, filename)) |
| 350 finally: | 351 finally: |
| 351 shutil.rmtree(local_dest_dir) | 352 shutil.rmtree(local_dest_dir) |
| 352 for filename in filenames: | 353 for filename in filenames: |
| 353 gs.delete_file(bucket=TEST_BUCKET, | 354 gs.delete_file(bucket=TEST_BUCKET, |
| 354 path=posixpath.join(remote_dir, subdir, filename)) | 355 path=posixpath.join(remote_dir, subdir, filename)) |
| 355 | 356 |
| 356 | 357 |
| 357 if __name__ == '__main__': | 358 if __name__ == '__main__': |
| 359 logging.basicConfig(level=logging.INFO) |
| 358 _test_upload_if_multiple_files() | 360 _test_upload_if_multiple_files() |
| 359 _test_upload_if_one_file() | 361 _test_upload_if_one_file() |
| 360 _test_public_read() | 362 _test_public_read() |
| 361 _test_authenticated_round_trip() | 363 _test_authenticated_round_trip() |
| 362 _test_dir_upload_and_download() | 364 _test_dir_upload_and_download() |
| 363 # TODO(epoger): Add _test_unauthenticated_access() to make sure we raise | 365 # TODO(epoger): Add _test_unauthenticated_access() to make sure we raise |
| 364 # an exception when we try to access without needed credentials. | 366 # an exception when we try to access without needed credentials. |
| OLD | NEW |