OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client 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 update_manifest.py.""" | 6 """Unit tests for update_manifest.py.""" |
7 | 7 |
8 __author__ = 'mball@google.com (Matt Ball)' | 8 __author__ = 'mball@google.com (Matt Ball)' |
9 | 9 |
10 import errno | 10 import errno |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 if length != None: | 55 if length != None: |
56 self.wfile.write(f.read(length)) | 56 self.wfile.write(f.read(length)) |
57 else: | 57 else: |
58 self.copyfile(f, self.wfile) | 58 self.copyfile(f, self.wfile) |
59 return HTTPHandler | 59 return HTTPHandler |
60 | 60 |
61 | 61 |
62 class FakeOptions(object): | 62 class FakeOptions(object): |
63 ''' Just a place holder for options ''' | 63 ''' Just a place holder for options ''' |
64 def __init__(self): | 64 def __init__(self): |
| 65 self.archive_id = None |
65 self.bundle_desc_url = None | 66 self.bundle_desc_url = None |
66 self.bundle_name = None | 67 self.bundle_name = None |
67 self.bundle_version = None | 68 self.bundle_version = None |
68 self.bundle_revision = None | 69 self.bundle_revision = None |
69 self.desc = None | 70 self.desc = None |
70 self.gsutil = os.path.join(TEST_DIR, 'fake_gsutil.bat' | 71 self.gsutil = os.path.join(TEST_DIR, 'fake_gsutil.bat' |
71 if sys.platform == 'win32' else 'fake_gsutil.py') | 72 if sys.platform == 'win32' else 'fake_gsutil.py') |
72 self.linux_arch_url = None | 73 self.linux_arch_url = None |
73 self.mac_arch_url = None | 74 self.mac_arch_url = None |
74 self.manifest_file = os.path.join(TEST_DIR, 'naclsdk_manifest_test.json') | 75 self.manifest_file = os.path.join(TEST_DIR, 'naclsdk_manifest_test.json') |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 manifest_object.HandleBundles() | 332 manifest_object.HandleBundles() |
332 manifest_object.UpdateWithOptions() | 333 manifest_object.UpdateWithOptions() |
333 | 334 |
334 options = FakeOptions() | 335 options = FakeOptions() |
335 options.bundle_name = 'pepper_1' | 336 options.bundle_name = 'pepper_1' |
336 options.bundle_revision = 0 | 337 options.bundle_revision = 0 |
337 manifest_object = update_manifest.UpdateSDKManifestFile(options) | 338 manifest_object = update_manifest.UpdateSDKManifestFile(options) |
338 manifest_object.HandleBundles() | 339 manifest_object.HandleBundles() |
339 manifest_object.UpdateWithOptions() | 340 manifest_object.UpdateWithOptions() |
340 | 341 |
| 342 # Verify that the bundle can be found via the --archive-id option. |
| 343 options = FakeOptions() |
| 344 options.archive_id = 'pepper_1_0' |
| 345 options.bundle_name = 'pepper_phony' |
| 346 options.bundle_version = -1 |
| 347 options.bundle_revision = -1 |
| 348 options.stability = 'dev' |
| 349 options.recommended = 'no' |
| 350 manifest_object = update_manifest.UpdateSDKManifestFile(options) |
| 351 manifest_object.HandleBundles() |
| 352 manifest_object.UpdateWithOptions() |
| 353 |
341 | 354 |
342 def main(): | 355 def main(): |
343 suite = unittest.TestLoader().loadTestsFromTestCase(TestUpdateManifest) | 356 suite = unittest.TestLoader().loadTestsFromTestCase(TestUpdateManifest) |
344 result = unittest.TextTestRunner(verbosity=2).run(suite) | 357 result = unittest.TextTestRunner(verbosity=2).run(suite) |
345 | 358 |
346 return int(not result.wasSuccessful()) | 359 return int(not result.wasSuccessful()) |
347 | 360 |
348 | 361 |
349 if __name__ == '__main__': | 362 if __name__ == '__main__': |
350 sys.exit(main()) | 363 sys.exit(main()) |
OLD | NEW |