Index: tools/isolate/run_test_from_archive_test.py |
diff --git a/tools/isolate/run_test_from_archive_test.py b/tools/isolate/run_test_from_archive_test.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..0a6f5c9ac261810f4ddbeb1b2a7deeb0274d059b |
--- /dev/null |
+++ b/tools/isolate/run_test_from_archive_test.py |
@@ -0,0 +1,59 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import json |
+import logging |
+import sys |
+import unittest |
+ |
+import run_test_from_archive |
+ |
+ |
+class RunTestFromArchiveTest(unittest.TestCase): |
+ def test_load_manifest_empty(self): |
+ m = run_test_from_archive.load_manifest('{}') |
+ self.assertEquals({}, m) |
+ |
+ def test_load_manifest_good(self): |
+ data = { |
+ u'command': [u'foo', u'bar'], |
+ u'files': { |
+ u'a': { |
+ u'link': u'somewhere', |
+ u'mode': 123, |
+ u'timestamp': 456, |
+ }, |
+ u'b': { |
+ u'mode': 123, |
+ u'sha-1': u'0123456789abcdef0123456789abcdef01234567' |
+ } |
+ }, |
+ u'read_only': False, |
+ u'relative_cwd': u'somewhere_else' |
+ } |
+ m = run_test_from_archive.load_manifest(json.dumps(data)) |
+ self.assertEquals(data, m) |
+ |
+ def test_load_manifest_bad(self): |
+ data = { |
+ u'files': { |
+ u'a': { |
+ u'link': u'somewhere', |
+ u'sha-1': u'0123456789abcdef0123456789abcdef01234567' |
+ } |
+ }, |
+ } |
+ try: |
+ run_test_from_archive.load_manifest(json.dumps(data)) |
+ self.fail() |
+ except run_test_from_archive.ConfigError: |
+ pass |
+ |
+ |
+ |
+if __name__ == '__main__': |
+ logging.basicConfig( |
+ level=(logging.DEBUG if '-v' in sys.argv else logging.ERROR)) |
+ unittest.main() |