| 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 from json_schema import CachedLoad | 6 from json_schema import CachedLoad |
| 7 import model | 7 import model |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 class ModelTest(unittest.TestCase): | 10 class ModelTest(unittest.TestCase): |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 "windowId", "windowType"], | 59 "windowId", "windowType"], |
| 60 sorted(object_prop.properties.keys())) | 60 sorted(object_prop.properties.keys())) |
| 61 | 61 |
| 62 def testChoices(self): | 62 def testChoices(self): |
| 63 self.assertEquals(model.PropertyType.CHOICES, | 63 self.assertEquals(model.PropertyType.CHOICES, |
| 64 self.tabs.functions['move'].params[0].type_) | 64 self.tabs.functions['move'].params[0].type_) |
| 65 | 65 |
| 66 def testPropertyNotImplemented(self): | 66 def testPropertyNotImplemented(self): |
| 67 (self.permissions_json[0]['types'][0] | 67 (self.permissions_json[0]['types'][0] |
| 68 ['properties']['permissions']['type']) = 'something' | 68 ['properties']['permissions']['type']) = 'something' |
| 69 self.assertRaises(model.ParseException, self.model.AddNamespace, | 69 self.assertRaises(NotImplementedError, self.model.AddNamespace, |
| 70 self.permissions_json[0], 'path/to/something.json') | 70 self.permissions_json[0], 'path/to/something.json') |
| 71 | 71 |
| 72 def testDescription(self): | 72 def testDescription(self): |
| 73 self.assertFalse( | 73 self.assertFalse( |
| 74 self.permissions.functions['contains'].params[0].description) | 74 self.permissions.functions['contains'].params[0].description) |
| 75 self.assertEquals('True if the extension has the specified permissions.', | 75 self.assertEquals('True if the extension has the specified permissions.', |
| 76 self.permissions.functions['contains'].callback.params[0].description) | 76 self.permissions.functions['contains'].callback.params[0].description) |
| 77 | 77 |
| 78 def testPropertyUnixName(self): | 78 def testPropertyUnixName(self): |
| 79 param = self.tabs.functions['move'].params[0] | 79 param = self.tabs.functions['move'].params[0] |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 'FOOBar': 'foo_bar', | 96 'FOOBar': 'foo_bar', |
| 97 'foo.bar': 'foo_bar', | 97 'foo.bar': 'foo_bar', |
| 98 'foo.BAR': 'foo_bar', | 98 'foo.BAR': 'foo_bar', |
| 99 'foo.barBAZ': 'foo_bar_baz' | 99 'foo.barBAZ': 'foo_bar_baz' |
| 100 } | 100 } |
| 101 for name in expectations: | 101 for name in expectations: |
| 102 self.assertEquals(expectations[name], model.UnixName(name)); | 102 self.assertEquals(expectations[name], model.UnixName(name)); |
| 103 | 103 |
| 104 if __name__ == '__main__': | 104 if __name__ == '__main__': |
| 105 unittest.main() | 105 unittest.main() |
| OLD | NEW |