| 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 | |
| 10 import os | 9 import os |
| 11 import posixpath | 10 import posixpath |
| 12 import random | 11 import random |
| 13 import shutil | 12 import shutil |
| 14 import sys | 13 import sys |
| 15 import tempfile | 14 import tempfile |
| 16 import time | 15 import time |
| 17 | 16 |
| 18 # Local imports. | 17 # Local imports. |
| 19 import gs_utils | 18 import gs_utils |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 assert file_contents == 'contents of %s\n' % filename, ( | 348 assert file_contents == 'contents of %s\n' % filename, ( |
| 350 '%s == "contents of %s\n"' % (file_contents, filename)) | 349 '%s == "contents of %s\n"' % (file_contents, filename)) |
| 351 finally: | 350 finally: |
| 352 shutil.rmtree(local_dest_dir) | 351 shutil.rmtree(local_dest_dir) |
| 353 for filename in filenames: | 352 for filename in filenames: |
| 354 gs.delete_file(bucket=TEST_BUCKET, | 353 gs.delete_file(bucket=TEST_BUCKET, |
| 355 path=posixpath.join(remote_dir, subdir, filename)) | 354 path=posixpath.join(remote_dir, subdir, filename)) |
| 356 | 355 |
| 357 | 356 |
| 358 if __name__ == '__main__': | 357 if __name__ == '__main__': |
| 359 logging.basicConfig(level=logging.INFO) | |
| 360 _test_upload_if_multiple_files() | 358 _test_upload_if_multiple_files() |
| 361 _test_upload_if_one_file() | 359 _test_upload_if_one_file() |
| 362 _test_public_read() | 360 _test_public_read() |
| 363 _test_authenticated_round_trip() | 361 _test_authenticated_round_trip() |
| 364 _test_dir_upload_and_download() | 362 _test_dir_upload_and_download() |
| 365 # TODO(epoger): Add _test_unauthenticated_access() to make sure we raise | 363 # TODO(epoger): Add _test_unauthenticated_access() to make sure we raise |
| 366 # an exception when we try to access without needed credentials. | 364 # an exception when we try to access without needed credentials. |
| OLD | NEW |