OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Unit tests for upload_to_google_storage.py.""" | 6 """Unit tests for upload_to_google_storage.py.""" |
7 | 7 |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import Queue | 10 import Queue |
(...skipping 11 matching lines...) Expand all Loading... | |
22 | 22 |
23 # ../third_party/gsutil/gsutil | 23 # ../third_party/gsutil/gsutil |
24 GSUTIL_DEFAULT_PATH = os.path.join( | 24 GSUTIL_DEFAULT_PATH = os.path.join( |
25 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 25 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
26 'third_party', 'gsutil', 'gsutil') | 26 'third_party', 'gsutil', 'gsutil') |
27 TEST_DIR = os.path.dirname(os.path.abspath(__file__)) | 27 TEST_DIR = os.path.dirname(os.path.abspath(__file__)) |
28 | 28 |
29 | 29 |
30 class UploadTests(unittest.TestCase): | 30 class UploadTests(unittest.TestCase): |
31 def setUp(self): | 31 def setUp(self): |
32 self.gsutil = GsutilMock(GSUTIL_DEFAULT_PATH) | 32 self.gsutil = GsutilMock(GSUTIL_DEFAULT_PATH, None) |
ghost stip (do not use)
2013/11/19 19:32:37
add a bug to add this to presubmit
| |
33 self.temp_dir = tempfile.mkdtemp(prefix='gstools_test') | 33 self.temp_dir = tempfile.mkdtemp(prefix='gstools_test') |
34 self.base_path = os.path.join(self.temp_dir, 'gstools') | 34 self.base_path = os.path.join(self.temp_dir, 'gstools') |
35 shutil.copytree(os.path.join(TEST_DIR, 'gstools'), self.base_path) | 35 shutil.copytree(os.path.join(TEST_DIR, 'gstools'), self.base_path) |
36 self.base_url = 'gs://sometesturl' | 36 self.base_url = 'gs://sometesturl' |
37 self.parser = optparse.OptionParser() | 37 self.parser = optparse.OptionParser() |
38 self.ret_codes = Queue.Queue() | 38 self.ret_codes = Queue.Queue() |
39 self.stdout_queue = Queue.Queue() | 39 self.stdout_queue = Queue.Queue() |
40 self.lorem_ipsum = os.path.join(self.base_path, 'lorem_ipsum.txt') | 40 self.lorem_ipsum = os.path.join(self.base_path, 'lorem_ipsum.txt') |
41 self.lorem_ipsum_sha1 = '7871c8e24da15bad8b0be2c36edc9dc77e37727f' | 41 self.lorem_ipsum_sha1 = '7871c8e24da15bad8b0be2c36edc9dc77e37727f' |
42 | 42 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 sys.stdin = StringIO.StringIO('\0'.join(inputs)) | 156 sys.stdin = StringIO.StringIO('\0'.join(inputs)) |
157 result = upload_to_google_storage.get_targets( | 157 result = upload_to_google_storage.get_targets( |
158 ['-'], | 158 ['-'], |
159 self.parser, | 159 self.parser, |
160 True) | 160 True) |
161 self.assertEqual(result, inputs) | 161 self.assertEqual(result, inputs) |
162 | 162 |
163 | 163 |
164 if __name__ == '__main__': | 164 if __name__ == '__main__': |
165 unittest.main() | 165 unittest.main() |
OLD | NEW |