OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """Unit tests for checkout.py.""" | 6 """Unit tests for checkout.py.""" |
7 | 7 |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import shutil | 10 import shutil |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 self.svn_base, self.svn_trunk) | 198 self.svn_base, self.svn_trunk) |
199 co = checkout.ReadOnlyCheckout(rw_co) | 199 co = checkout.ReadOnlyCheckout(rw_co) |
200 self.assertEquals(self.root_dir, co.project_path) | 200 self.assertEquals(self.root_dir, co.project_path) |
201 revision = co.prepare() | 201 revision = co.prepare() |
202 self.assertTrue(isinstance(revision, int)) | 202 self.assertTrue(isinstance(revision, int)) |
203 self.assertEquals(2, revision) | 203 self.assertEquals(2, revision) |
204 self.assertEquals('pouet', co.get_settings('bar')) | 204 self.assertEquals('pouet', co.get_settings('bar')) |
205 content = read(os.path.join(self.root_dir, 'svn_utils_test.txt')) | 205 content = read(os.path.join(self.root_dir, 'svn_utils_test.txt')) |
206 self.assertTrue(os.path.join(self.root_dir, 'svn_utils_test.txt')) | 206 self.assertTrue(os.path.join(self.root_dir, 'svn_utils_test.txt')) |
207 co.apply_patch(patch.auto_mangle_git_patch(GIT_PATCH)) | 207 co.apply_patch(patch.auto_mangle_git_patch(GIT_PATCH)) |
| 208 # Hackish to verify _branches() internal function. |
| 209 # pylint: disable=W0212 |
| 210 self.assertEquals( |
| 211 (['master', 'working_branch'], 'working_branch'), |
| 212 co.checkout._branches()) |
208 content_lines = content.splitlines(True) | 213 content_lines = content.splitlines(True) |
209 content_modified = ''.join(content_lines[0:5] + ['FOO!\n'] + | 214 content_modified = ''.join(content_lines[0:5] + ['FOO!\n'] + |
210 content_lines[5:]) | 215 content_lines[5:]) |
211 self.assertEquals(content_modified, | 216 self.assertEquals(content_modified, |
212 read(os.path.join(self.root_dir, 'svn_utils_test.txt'))) | 217 read(os.path.join(self.root_dir, 'svn_utils_test.txt'))) |
213 self.assertEquals('FAKE', co.commit('msg', 'usr')) | 218 self.assertEquals('FAKE', co.commit('msg', 'usr')) |
214 revision = co.prepare() | 219 revision = co.prepare() |
215 self.assertEquals(content, | 220 self.assertEquals(content, |
216 read(os.path.join(self.root_dir, 'svn_utils_test.txt'))) | 221 read(os.path.join(self.root_dir, 'svn_utils_test.txt'))) |
217 | 222 |
218 | 223 |
219 | 224 |
220 | 225 |
221 if __name__ == '__main__': | 226 if __name__ == '__main__': |
222 if '-v' in sys.argv: | 227 if '-v' in sys.argv: |
223 DEBUGGING = True | 228 DEBUGGING = True |
224 logging.basicConfig(level=logging.INFO) | 229 logging.basicConfig(level=logging.INFO) |
225 else: | 230 else: |
226 logging.basicConfig(level=logging.ERROR) | 231 logging.basicConfig(level=logging.ERROR) |
227 unittest.main() | 232 unittest.main() |
OLD | NEW |