OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 gclient_scm.py.""" | 6 """Unit tests for gclient_scm.py.""" |
7 | 7 |
8 # pylint: disable=E1103 | 8 # pylint: disable=E1103 |
9 | 9 |
10 # Import before super_mox to keep valid references. | 10 # Import before super_mox to keep valid references. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 self.assertEqual(scm.FullUrlForRelativeUrl('/crap'), 'svn://a/b/crap') | 113 self.assertEqual(scm.FullUrlForRelativeUrl('/crap'), 'svn://a/b/crap') |
114 | 114 |
115 def testGITFullUrlForRelativeUrl(self): | 115 def testGITFullUrlForRelativeUrl(self): |
116 self.url = 'git://a/b/c/d' | 116 self.url = 'git://a/b/c/d' |
117 | 117 |
118 self.mox.ReplayAll() | 118 self.mox.ReplayAll() |
119 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 119 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
120 relpath=self.relpath) | 120 relpath=self.relpath) |
121 self.assertEqual(scm.FullUrlForRelativeUrl('/crap'), 'git://a/b/c/crap') | 121 self.assertEqual(scm.FullUrlForRelativeUrl('/crap'), 'git://a/b/c/crap') |
122 | 122 |
| 123 def testGITFakeHttpUrl(self): |
| 124 self.url = 'git+http://foo' |
| 125 |
| 126 self.mox.ReplayAll() |
| 127 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 128 relpath=self.relpath) |
| 129 self.assertEqual(scm.url, 'http://foo') |
| 130 |
| 131 def testGITFakeHttpsUrl(self): |
| 132 self.url = 'git+https://foo' |
| 133 |
| 134 self.mox.ReplayAll() |
| 135 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 136 relpath=self.relpath) |
| 137 self.assertEqual(scm.url, 'https://foo') |
| 138 |
123 def testRunCommandException(self): | 139 def testRunCommandException(self): |
124 options = self.Options(verbose=False) | 140 options = self.Options(verbose=False) |
125 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) | 141 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) |
126 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 142 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
127 | 143 |
128 self.mox.ReplayAll() | 144 self.mox.ReplayAll() |
129 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 145 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
130 relpath=self.relpath) | 146 relpath=self.relpath) |
131 exception = "Unsupported argument(s): %s" % ','.join(self.args) | 147 exception = "Unsupported argument(s): %s" % ','.join(self.args) |
132 self.assertRaisesError(exception, scm.RunCommand, | 148 self.assertRaisesError(exception, scm.RunCommand, |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 982 |
967 if __name__ == '__main__': | 983 if __name__ == '__main__': |
968 if '-v' in sys.argv: | 984 if '-v' in sys.argv: |
969 logging.basicConfig( | 985 logging.basicConfig( |
970 level=logging.DEBUG, | 986 level=logging.DEBUG, |
971 format='%(asctime).19s %(levelname)s %(filename)s:' | 987 format='%(asctime).19s %(levelname)s %(filename)s:' |
972 '%(lineno)s %(message)s') | 988 '%(lineno)s %(message)s') |
973 unittest.main() | 989 unittest.main() |
974 | 990 |
975 # vim: ts=2:sw=2:tw=80:et: | 991 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |