Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: tools/isolate/run_test_from_archive_test.py

Issue 10880009: Enforces strict manifest content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implemented lower-overhead straight forward technique Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 import json
7 import logging
8 import sys
9 import unittest
10
11 import run_test_from_archive
12
13
14 class RunTestFromArchiveTest(unittest.TestCase):
15 def test_load_manifest_empty(self):
16 m = run_test_from_archive.load_manifest('{}')
17 self.assertEquals({}, m)
18
19 def test_load_manifest_good(self):
20 data = {
21 u'command': [u'foo', u'bar'],
22 u'files': {
23 u'a': {
24 u'link': u'somewhere',
25 u'mode': 123,
26 u'timestamp': 456,
27 },
28 u'b': {
29 u'mode': 123,
30 u'sha-1': u'0123456789abcdef0123456789abcdef01234567'
31 }
32 },
33 u'read_only': False,
34 u'relative_cwd': u'somewhere_else'
35 }
36 m = run_test_from_archive.load_manifest(json.dumps(data))
37 self.assertEquals(data, m)
38
39 def test_load_manifest_bad(self):
40 data = {
41 u'files': {
42 u'a': {
43 u'link': u'somewhere',
44 u'sha-1': u'0123456789abcdef0123456789abcdef01234567'
45 }
46 },
47 }
48 try:
49 run_test_from_archive.load_manifest(json.dumps(data))
50 self.fail()
51 except run_test_from_archive.ConfigError:
52 pass
53
54
55
56 if __name__ == '__main__':
57 logging.basicConfig(
58 level=(logging.DEBUG if '-v' in sys.argv else logging.ERROR))
59 unittest.main()
OLDNEW
« tools/isolate/run_test_from_archive.py ('K') | « tools/isolate/run_test_from_archive.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698