| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 # Copyright 2013 Google Inc. All Rights Reserved. | 2 # Copyright 2013 Google Inc. All Rights Reserved. |
| 3 # | 3 # |
| 4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 7 # | 7 # |
| 8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 # | 9 # |
| 10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| 11 # distributed under the License is distributed on an "AS IS" BASIS, | 11 # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 # See the License for the specific language governing permissions and | 13 # See the License for the specific language governing permissions and |
| 14 # limitations under the License. | 14 # limitations under the License. |
| 15 """Integration tests for gsutil -D option.""" | 15 """Integration tests for gsutil -D option.""" |
| 16 | 16 |
| 17 from __future__ import absolute_import | 17 from __future__ import absolute_import |
| 18 | 18 |
| 19 import platform |
| 20 |
| 19 import gslib | 21 import gslib |
| 20 from gslib.cs_api_map import ApiSelector | 22 from gslib.cs_api_map import ApiSelector |
| 21 import gslib.tests.testcase as testcase | 23 import gslib.tests.testcase as testcase |
| 22 from gslib.tests.testcase.integration_testcase import SkipForS3 | 24 from gslib.tests.testcase.integration_testcase import SkipForS3 |
| 23 from gslib.tests.util import ObjectToURI as suri | 25 from gslib.tests.util import ObjectToURI as suri |
| 24 from gslib.tests.util import SetBotoConfigForTest | 26 from gslib.tests.util import SetBotoConfigForTest |
| 25 from gslib.util import ONE_KIB | 27 from gslib.util import ONE_KIB |
| 26 | 28 |
| 27 | 29 |
| 28 @SkipForS3('-D output is implementation-specific.') | 30 @SkipForS3('-D output is implementation-specific.') |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 self.assertIn('header: Cache-Control: private, max-age=0', | 83 self.assertIn('header: Cache-Control: private, max-age=0', |
| 82 stderr) | 84 stderr) |
| 83 self.assertIn('header: Last-Modified: ', stderr) | 85 self.assertIn('header: Last-Modified: ', stderr) |
| 84 self.assertIn('header: ETag: "781e5e245d69b566979b86e28d23f2c7"', stderr) | 86 self.assertIn('header: ETag: "781e5e245d69b566979b86e28d23f2c7"', stderr) |
| 85 self.assertIn('header: x-goog-generation: ', stderr) | 87 self.assertIn('header: x-goog-generation: ', stderr) |
| 86 self.assertIn('header: x-goog-metageneration: 1', stderr) | 88 self.assertIn('header: x-goog-metageneration: 1', stderr) |
| 87 self.assertIn('header: x-goog-hash: crc32c=KAwGng==', stderr) | 89 self.assertIn('header: x-goog-hash: crc32c=KAwGng==', stderr) |
| 88 self.assertIn('header: x-goog-hash: md5=eB5eJF1ptWaXm4bijSPyxw==', stderr) | 90 self.assertIn('header: x-goog-hash: md5=eB5eJF1ptWaXm4bijSPyxw==', stderr) |
| 89 elif self.test_api == ApiSelector.JSON: | 91 elif self.test_api == ApiSelector.JSON: |
| 90 self.assertRegexpMatches( | 92 self.assertRegexpMatches( |
| 91 stderr, '.*GET.*b/%s/o/%s.*user-agent:.*gsutil/%s' % | 93 stderr, '.*GET.*b/%s/o/%s.*user-agent:.*gsutil/%s.Python/%s' % |
| 92 (key_uri.bucket_name, key_uri.object_name, gslib.VERSION)) | 94 (key_uri.bucket_name, key_uri.object_name, gslib.VERSION, |
| 95 platform.python_version())) |
| 93 self.assertIn(('header: Cache-Control: no-cache, no-store, max-age=0, ' | 96 self.assertIn(('header: Cache-Control: no-cache, no-store, max-age=0, ' |
| 94 'must-revalidate'), stderr) | 97 'must-revalidate'), stderr) |
| 95 self.assertIn("md5Hash: u'eB5eJF1ptWaXm4bijSPyxw=='", stderr) | 98 self.assertIn("md5Hash: u'eB5eJF1ptWaXm4bijSPyxw=='", stderr) |
| 96 | 99 |
| 97 if gslib.IS_PACKAGE_INSTALL: | 100 if gslib.IS_PACKAGE_INSTALL: |
| 98 self.assertIn('PACKAGED_GSUTIL_INSTALLS_DO_NOT_HAVE_CHECKSUMS', stdout) | 101 self.assertIn('PACKAGED_GSUTIL_INSTALLS_DO_NOT_HAVE_CHECKSUMS', stdout) |
| 99 else: | 102 else: |
| 100 self.assertRegexpMatches(stdout, r'.*checksum: [0-9a-f]{32}.*') | 103 self.assertRegexpMatches(stdout, r'.*checksum: [0-9a-f]{32}.*') |
| 101 self.assertIn('gsutil version: %s' % gslib.VERSION, stdout) | 104 self.assertIn('gsutil version: %s' % gslib.VERSION, stdout) |
| 102 self.assertIn('boto version: ', stdout) | 105 self.assertIn('boto version: ', stdout) |
| 103 self.assertIn('python version: ', stdout) | 106 self.assertIn('python version: ', stdout) |
| 104 self.assertIn('OS: ', stdout) | 107 self.assertIn('OS: ', stdout) |
| 105 self.assertIn('multiprocessing available: ', stdout) | 108 self.assertIn('multiprocessing available: ', stdout) |
| 106 self.assertIn('using cloud sdk: ', stdout) | 109 self.assertIn('using cloud sdk: ', stdout) |
| 107 self.assertIn('config path: ', stdout) | 110 self.assertIn('config path: ', stdout) |
| 108 self.assertIn('gsutil path: ', stdout) | 111 self.assertIn('gsutil path: ', stdout) |
| 109 self.assertIn('compiled crcmod: ', stdout) | 112 self.assertIn('compiled crcmod: ', stdout) |
| 110 self.assertIn('installed via package manager: ', stdout) | 113 self.assertIn('installed via package manager: ', stdout) |
| 111 self.assertIn('editable install: ', stdout) | 114 self.assertIn('editable install: ', stdout) |
| OLD | NEW |