| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from app_yaml_helper import AppYamlHelper | 8 from app_yaml_helper import AppYamlHelper |
| 9 from file_system import FileNotFoundError | 9 from file_system import FileNotFoundError |
| 10 from host_file_system_creator import HostFileSystemCreator | 10 from host_file_system_creator import HostFileSystemCreator |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 def constructor(branch, revision=None): | 89 def constructor(branch, revision=None): |
| 90 return MockFileSystem.Create(TestFileSystem(test_data), | 90 return MockFileSystem.Create(TestFileSystem(test_data), |
| 91 updates[:revision]) | 91 updates[:revision]) |
| 92 host_file_system_creator = HostFileSystemCreator( | 92 host_file_system_creator = HostFileSystemCreator( |
| 93 ObjectStoreCreator.ForTest(), | 93 ObjectStoreCreator.ForTest(), |
| 94 constructor_for_test=constructor) | 94 constructor_for_test=constructor) |
| 95 helper = AppYamlHelper('server2/app.yaml', | 95 helper = AppYamlHelper('server2/app.yaml', |
| 96 file_system_at_head, | 96 file_system_at_head, |
| 97 ObjectStoreCreator.ForTest(disable_wrappers=False), | 97 ObjectStoreCreator.ForTest(disable_wrappers=False), |
| 98 host_file_system_creator, | 98 host_file_system_creator) |
| 99 'trunk') | |
| 100 | 99 |
| 101 def assert_is_up_to_date(version): | 100 def assert_is_up_to_date(version): |
| 102 self.assertTrue(helper.IsUpToDate(version), | 101 self.assertTrue(helper.IsUpToDate(version), |
| 103 '%s is not up to date' % version) | 102 '%s is not up to date' % version) |
| 104 self.assertRaises(ValueError, | 103 self.assertRaises(ValueError, |
| 105 helper.GetFirstRevisionGreaterThan, version) | 104 helper.GetFirstRevisionGreaterThan, version) |
| 106 | 105 |
| 107 self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) | 106 self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) |
| 108 assert_is_up_to_date('1-0-0') | 107 assert_is_up_to_date('1-0-0') |
| 109 assert_is_up_to_date('1-5-0') | 108 assert_is_up_to_date('1-5-0') |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 self.assertEqual(6, helper.GetFirstRevisionGreaterThan('2-1-0')) | 166 self.assertEqual(6, helper.GetFirstRevisionGreaterThan('2-1-0')) |
| 168 self.assertEqual(7, helper.GetFirstRevisionGreaterThan('2-2-0')) | 167 self.assertEqual(7, helper.GetFirstRevisionGreaterThan('2-2-0')) |
| 169 self.assertEqual(7, helper.GetFirstRevisionGreaterThan('2-3-0')) | 168 self.assertEqual(7, helper.GetFirstRevisionGreaterThan('2-3-0')) |
| 170 self.assertEqual(8, helper.GetFirstRevisionGreaterThan('2-4-0')) | 169 self.assertEqual(8, helper.GetFirstRevisionGreaterThan('2-4-0')) |
| 171 self.assertEqual(8, helper.GetFirstRevisionGreaterThan('2-5-0')) | 170 self.assertEqual(8, helper.GetFirstRevisionGreaterThan('2-5-0')) |
| 172 assert_is_up_to_date('2-6-0') | 171 assert_is_up_to_date('2-6-0') |
| 173 assert_is_up_to_date('2-7-0') | 172 assert_is_up_to_date('2-7-0') |
| 174 | 173 |
| 175 if __name__ == '__main__': | 174 if __name__ == '__main__': |
| 176 unittest.main() | 175 unittest.main() |
| OLD | NEW |