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 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 # TODO: Right now, most tests use the XML API. Instead, they should respect | 80 # TODO: Right now, most tests use the XML API. Instead, they should respect |
81 # prefer_api in the same way that commands do. | 81 # prefer_api in the same way that commands do. |
82 @unittest.skipUnless(util.RUN_INTEGRATION_TESTS, | 82 @unittest.skipUnless(util.RUN_INTEGRATION_TESTS, |
83 'Not running integration tests.') | 83 'Not running integration tests.') |
84 class GsUtilIntegrationTestCase(base.GsUtilTestCase): | 84 class GsUtilIntegrationTestCase(base.GsUtilTestCase): |
85 """Base class for gsutil integration tests.""" | 85 """Base class for gsutil integration tests.""" |
86 GROUP_TEST_ADDRESS = 'gs-discussion@googlegroups.com' | 86 GROUP_TEST_ADDRESS = 'gs-discussion@googlegroups.com' |
87 GROUP_TEST_ID = ( | 87 GROUP_TEST_ID = ( |
88 '00b4903a97d097895ab58ef505d535916a712215b79c3e54932c2eb502ad97f5') | 88 '00b4903a97d097895ab58ef505d535916a712215b79c3e54932c2eb502ad97f5') |
89 USER_TEST_ADDRESS = 'gs-team@google.com' | 89 USER_TEST_ADDRESS = 'gsutiltestuser@gmail.com' |
90 USER_TEST_ID = ( | 90 USER_TEST_ID = ( |
91 '00b4903a9703325c6bfc98992d72e75600387a64b3b6bee9ef74613ef8842080') | 91 '00b4903a97b201e40d2a5a3ddfe044bb1ab79c75b2e817cbe350297eccc81c84') |
92 DOMAIN_TEST = 'google.com' | 92 DOMAIN_TEST = 'google.com' |
93 # No one can create this bucket without owning the gmail.com domain, and we | 93 # No one can create this bucket without owning the gmail.com domain, and we |
94 # won't create this bucket, so it shouldn't exist. | 94 # won't create this bucket, so it shouldn't exist. |
95 # It would be nice to use google.com here but JSON API disallows | 95 # It would be nice to use google.com here but JSON API disallows |
96 # 'google' in resource IDs. | 96 # 'google' in resource IDs. |
97 nonexistent_bucket_name = 'nonexistent-bucket-foobar.gmail.com' | 97 nonexistent_bucket_name = 'nonexistent-bucket-foobar.gmail.com' |
98 | 98 |
99 def setUp(self): | 99 def setUp(self): |
100 """Creates base configuration for integration tests.""" | 100 """Creates base configuration for integration tests.""" |
101 super(GsUtilIntegrationTestCase, self).setUp() | 101 super(GsUtilIntegrationTestCase, self).setUp() |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 expected_status: The expected return code. If not specified, defaults to | 384 expected_status: The expected return code. If not specified, defaults to |
385 0. If the return code is a different value, an exception | 385 0. If the return code is a different value, an exception |
386 is raised. | 386 is raised. |
387 stdin: A string of data to pipe to the process as standard input. | 387 stdin: A string of data to pipe to the process as standard input. |
388 | 388 |
389 Returns: | 389 Returns: |
390 A tuple containing the desired return values specified by the return_* | 390 A tuple containing the desired return values specified by the return_* |
391 arguments. | 391 arguments. |
392 """ | 392 """ |
393 cmd = ([gslib.GSUTIL_PATH] + ['--testexceptiontraces'] + | 393 cmd = ([gslib.GSUTIL_PATH] + ['--testexceptiontraces'] + |
394 ['-o', 'GSUtil:default_project_id=' + PopulateProjectId()] + | 394 ['-o', 'GSUtil:default_project_id=' + PopulateProjectId()] + |
395 cmd) | 395 cmd) |
396 if IS_WINDOWS: | 396 if IS_WINDOWS: |
397 cmd = [sys.executable] + cmd | 397 cmd = [sys.executable] + cmd |
398 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 398 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
399 stdin=subprocess.PIPE) | 399 stdin=subprocess.PIPE) |
400 (stdout, stderr) = p.communicate(stdin) | 400 (stdout, stderr) = p.communicate(stdin) |
401 status = p.returncode | 401 status = p.returncode |
402 | 402 |
403 if expected_status is not None: | 403 if expected_status is not None: |
404 self.assertEqual( | 404 self.assertEqual( |
405 status, expected_status, | 405 status, expected_status, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 @contextmanager | 464 @contextmanager |
465 def SetAnonymousBotoCreds(self): | 465 def SetAnonymousBotoCreds(self): |
466 boto_config_path = self.CreateTempFile( | 466 boto_config_path = self.CreateTempFile( |
467 contents=BOTO_CONFIG_CONTENTS_IGNORE_ANON_WARNING) | 467 contents=BOTO_CONFIG_CONTENTS_IGNORE_ANON_WARNING) |
468 with SetBotoConfigFileForTest(boto_config_path): | 468 with SetBotoConfigFileForTest(boto_config_path): |
469 # Make sure to reset Developer Shell credential port so that the child | 469 # Make sure to reset Developer Shell credential port so that the child |
470 # gsutil process is really anonymous. | 470 # gsutil process is really anonymous. |
471 with SetEnvironmentForTest({'DEVSHELL_CLIENT_PORT': None}): | 471 with SetEnvironmentForTest({'DEVSHELL_CLIENT_PORT': None}): |
472 yield | 472 yield |
OLD | NEW |