Show More
@@ -1,183 +1,183 b'' | |||
|
1 | 1 | from __future__ import with_statement |
|
2 | 2 | |
|
3 | 3 | import stat |
|
4 | 4 | from rhodecode.lib.vcs.nodes import DirNode |
|
5 | 5 | from rhodecode.lib.vcs.nodes import FileNode |
|
6 | 6 | from rhodecode.lib.vcs.nodes import Node |
|
7 | 7 | from rhodecode.lib.vcs.nodes import NodeError |
|
8 | 8 | from rhodecode.lib.vcs.nodes import NodeKind |
|
9 | 9 | from rhodecode.lib.vcs.utils.compat import unittest |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | class NodeBasicTest(unittest.TestCase): |
|
13 | 13 | |
|
14 | 14 | def test_init(self): |
|
15 | 15 | """ |
|
16 | 16 | Cannot innitialize Node objects with path with slash at the beginning. |
|
17 | 17 | """ |
|
18 | 18 | wrong_paths = ( |
|
19 | 19 | '/foo', |
|
20 | 20 | '/foo/bar' |
|
21 | 21 | ) |
|
22 | 22 | for path in wrong_paths: |
|
23 | 23 | self.assertRaises(NodeError, Node, path, NodeKind.FILE) |
|
24 | 24 | |
|
25 | 25 | wrong_paths = ( |
|
26 | 26 | '/foo/', |
|
27 | 27 | '/foo/bar/' |
|
28 | 28 | ) |
|
29 | 29 | for path in wrong_paths: |
|
30 | 30 | self.assertRaises(NodeError, Node, path, NodeKind.DIR) |
|
31 | 31 | |
|
32 | 32 | def test_name(self): |
|
33 | 33 | node = Node('', NodeKind.DIR) |
|
34 | 34 | self.assertEqual(node.name, '') |
|
35 | 35 | |
|
36 | 36 | node = Node('path', NodeKind.FILE) |
|
37 | 37 | self.assertEqual(node.name, 'path') |
|
38 | 38 | |
|
39 | 39 | node = Node('path/', NodeKind.DIR) |
|
40 | 40 | self.assertEqual(node.name, 'path') |
|
41 | 41 | |
|
42 | 42 | node = Node('some/path', NodeKind.FILE) |
|
43 | 43 | self.assertEqual(node.name, 'path') |
|
44 | 44 | |
|
45 | 45 | node = Node('some/path/', NodeKind.DIR) |
|
46 | 46 | self.assertEqual(node.name, 'path') |
|
47 | 47 | |
|
48 | 48 | def test_root_node(self): |
|
49 | 49 | self.assertRaises(NodeError, Node, '', NodeKind.FILE) |
|
50 | 50 | |
|
51 | 51 | def test_kind_setter(self): |
|
52 | 52 | node = Node('', NodeKind.DIR) |
|
53 | 53 | self.assertRaises(NodeError, setattr, node, 'kind', NodeKind.FILE) |
|
54 | 54 | |
|
55 | 55 | def _test_parent_path(self, node_path, expected_parent_path): |
|
56 | 56 | """ |
|
57 | 57 | Tests if node's parent path are properly computed. |
|
58 | 58 | """ |
|
59 | 59 | node = Node(node_path, NodeKind.DIR) |
|
60 | 60 | parent_path = node.get_parent_path() |
|
61 | 61 | self.assertTrue(parent_path.endswith('/') or \ |
|
62 | 62 | node.is_root() and parent_path == '') |
|
63 | 63 | self.assertEqual(parent_path, expected_parent_path, |
|
64 | 64 | "Node's path is %r and parent path is %r but should be %r" |
|
65 | 65 | % (node.path, parent_path, expected_parent_path)) |
|
66 | 66 | |
|
67 | 67 | def test_parent_path(self): |
|
68 | 68 | test_paths = ( |
|
69 | 69 | # (node_path, expected_parent_path) |
|
70 | 70 | ('', ''), |
|
71 | 71 | ('some/path/', 'some/'), |
|
72 | 72 | ('some/longer/path/', 'some/longer/'), |
|
73 | 73 | ) |
|
74 | 74 | for node_path, expected_parent_path in test_paths: |
|
75 | 75 | self._test_parent_path(node_path, expected_parent_path) |
|
76 | 76 | |
|
77 | 77 | ''' |
|
78 | 78 | def _test_trailing_slash(self, path): |
|
79 | 79 | if not path.endswith('/'): |
|
80 | 80 | self.fail("Trailing slash tests needs paths to end with slash") |
|
81 | 81 | for kind in NodeKind.FILE, NodeKind.DIR: |
|
82 | 82 | self.assertRaises(NodeError, Node, path=path, kind=kind) |
|
83 | 83 | |
|
84 | 84 | def test_trailing_slash(self): |
|
85 | 85 | for path in ('/', 'foo/', 'foo/bar/', 'foo/bar/biz/'): |
|
86 | 86 | self._test_trailing_slash(path) |
|
87 | 87 | ''' |
|
88 | 88 | |
|
89 | 89 | def test_is_file(self): |
|
90 | 90 | node = Node('any', NodeKind.FILE) |
|
91 | 91 | self.assertTrue(node.is_file()) |
|
92 | 92 | |
|
93 | 93 | node = FileNode('any') |
|
94 | 94 | self.assertTrue(node.is_file()) |
|
95 | 95 | self.assertRaises(AttributeError, getattr, node, 'nodes') |
|
96 | 96 | |
|
97 | 97 | def test_is_dir(self): |
|
98 | 98 | node = Node('any_dir', NodeKind.DIR) |
|
99 | 99 | self.assertTrue(node.is_dir()) |
|
100 | 100 | |
|
101 | 101 | node = DirNode('any_dir') |
|
102 | 102 | |
|
103 | 103 | self.assertTrue(node.is_dir()) |
|
104 | 104 | self.assertRaises(NodeError, getattr, node, 'content') |
|
105 | 105 | |
|
106 | 106 | def test_dir_node_iter(self): |
|
107 | 107 | nodes = [ |
|
108 | 108 | DirNode('docs'), |
|
109 | 109 | DirNode('tests'), |
|
110 | 110 | FileNode('bar'), |
|
111 | 111 | FileNode('foo'), |
|
112 | 112 | FileNode('readme.txt'), |
|
113 | 113 | FileNode('setup.py'), |
|
114 | 114 | ] |
|
115 | 115 | dirnode = DirNode('', nodes=nodes) |
|
116 | 116 | for node in dirnode: |
|
117 | 117 | node == dirnode.get_node(node.path) |
|
118 | 118 | |
|
119 | 119 | def test_node_state(self): |
|
120 | 120 | """ |
|
121 | 121 | Without link to changeset nodes should raise NodeError. |
|
122 | 122 | """ |
|
123 | 123 | node = FileNode('anything') |
|
124 | 124 | self.assertRaises(NodeError, getattr, node, 'state') |
|
125 | 125 | node = DirNode('anything') |
|
126 | 126 | self.assertRaises(NodeError, getattr, node, 'state') |
|
127 | 127 | |
|
128 | 128 | def test_file_node_stat(self): |
|
129 | 129 | node = FileNode('foobar', 'empty... almost') |
|
130 | 130 | mode = node.mode # default should be 0100644 |
|
131 | 131 | self.assertTrue(mode & stat.S_IRUSR) |
|
132 | 132 | self.assertTrue(mode & stat.S_IWUSR) |
|
133 | 133 | self.assertTrue(mode & stat.S_IRGRP) |
|
134 | 134 | self.assertTrue(mode & stat.S_IROTH) |
|
135 | 135 | self.assertFalse(mode & stat.S_IWGRP) |
|
136 | 136 | self.assertFalse(mode & stat.S_IWOTH) |
|
137 | 137 | self.assertFalse(mode & stat.S_IXUSR) |
|
138 | 138 | self.assertFalse(mode & stat.S_IXGRP) |
|
139 | 139 | self.assertFalse(mode & stat.S_IXOTH) |
|
140 | 140 | |
|
141 | 141 | def test_file_node_is_executable(self): |
|
142 | 142 | node = FileNode('foobar', 'empty... almost', mode=0100755) |
|
143 |
self.assertTrue(node.is_executable |
|
|
143 | self.assertTrue(node.is_executable) | |
|
144 | 144 | |
|
145 | 145 | node = FileNode('foobar', 'empty... almost', mode=0100500) |
|
146 |
self.assertTrue(node.is_executable |
|
|
146 | self.assertTrue(node.is_executable) | |
|
147 | 147 | |
|
148 | 148 | node = FileNode('foobar', 'empty... almost', mode=0100644) |
|
149 |
self.assertFalse(node.is_executable |
|
|
149 | self.assertFalse(node.is_executable) | |
|
150 | 150 | |
|
151 | 151 | def test_mimetype(self): |
|
152 | 152 | py_node = FileNode('test.py') |
|
153 | 153 | tar_node = FileNode('test.tar.gz') |
|
154 | 154 | |
|
155 | 155 | ext = 'CustomExtension' |
|
156 | 156 | |
|
157 | 157 | my_node2 = FileNode('myfile2') |
|
158 | 158 | my_node2._mimetype = [ext] |
|
159 | 159 | |
|
160 | 160 | my_node3 = FileNode('myfile3') |
|
161 | 161 | my_node3._mimetype = [ext,ext] |
|
162 | 162 | |
|
163 | 163 | self.assertEqual(py_node.mimetype,'text/x-python') |
|
164 | 164 | self.assertEqual(py_node.get_mimetype(),('text/x-python',None)) |
|
165 | 165 | |
|
166 | 166 | self.assertEqual(tar_node.mimetype,'application/x-tar') |
|
167 | 167 | self.assertEqual(tar_node.get_mimetype(),('application/x-tar','gzip')) |
|
168 | 168 | |
|
169 | 169 | self.assertRaises(NodeError,my_node2.get_mimetype) |
|
170 | 170 | |
|
171 | 171 | self.assertEqual(my_node3.mimetype,ext) |
|
172 | 172 | self.assertEqual(my_node3.get_mimetype(),[ext,ext]) |
|
173 | 173 | |
|
174 | 174 | class NodeContentTest(unittest.TestCase): |
|
175 | 175 | |
|
176 | 176 | def test_if_binary(self): |
|
177 | 177 | data = """\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1f??a\x00\x00\x00\x04gAMA\x00\x00\xaf?7\x05\x8a?\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq?e<\x00\x00\x025IDAT8?\xa5\x93?K\x94Q\x14\x87\x9f\xf7?Q\x1bs4?\x03\x9a\xa8?B\x02\x8b$\x10[U;i\x13?6h?&h[?"\x14j?\xa2M\x7fB\x14F\x9aQ?&\x842?\x0b\x89"\x82??!?\x9c!\x9c2l??{N\x8bW\x9dY\xb4\t/\x1c?=\x9b?}????\xa9*;9!?\x83\x91?[?\\v*?D\x04\'`EpNp\xa2X\'U?pVq"Sw.\x1e?\x08\x01D?jw????\xbc??7{|\x9b?\x89$\x01??W@\x15\x9c\x05q`Lt/\x97?\x94\xa1d?\x18~?\x18?\x18W[%\xb0?\x83??\x14\x88\x8dB?\xa6H\tL\tl\x19>/\x01`\xac\xabx?\x9cl\nx\xb0\x98\x07\x95\x88D$"q[\x19?d\x00(o\n\xa0??\x7f\xb9\xa4?\x1bF\x1f\x8e\xac\xa8?j??eUU}?.?\x9f\x8cE??x\x94??\r\xbdtoJU5"0N\x10U?\x00??V\t\x02\x9f\x81?U?\x00\x9eM\xae2?r\x9b7\x83\x82\x8aP3????.?&"?\xb7ZP \x0c<?O\xa5\t}\xb8?\x99\xa6?\x87?\x1di|/\xa0??0\xbe\x1fp?d&\x1a\xad\x95\x8a\x07?\t*\x10??b:?d?.\x13C\x8a?\x12\xbe\xbf\x8e?{???\x08?\x80\xa7\x13+d\x13>J?\x80\x15T\x95\x9a\x00??S\x8c\r?\xa1\x03\x07?\x96\x9b\xa7\xab=E??\xa4\xb3?\x19q??B\x91=\x8d??k?J\x0bV"??\xf7x?\xa1\x00?\\.\x87\x87???\x02F@D\x99],??\x10#?X\xb7=\xb9\x10?Z\x1by???cI??\x1ag?\x92\xbc?T?t[\x92\x81?<_\x17~\x92\x88?H%?\x10Q\x02\x9f\n\x81qQ\x0bm?\x1bX?\xb1AK\xa6\x9e\xb9?u\xb2?1\xbe|/\x92M@\xa2!F?\xa9>"\r<DT?>\x92\x8e?>\x9a9Qv\x127?a\xac?Y?8?:??]X???9\x80\xb7?u?\x0b#BZ\x8d=\x1d?p\x00\x00\x00\x00IEND\xaeB`\x82""" |
|
178 | 178 | filenode = FileNode('calendar.png', content=data) |
|
179 | 179 | self.assertTrue(filenode.is_binary) |
|
180 | 180 | |
|
181 | 181 | |
|
182 | 182 | if __name__ == '__main__': |
|
183 | 183 | unittest.main() |
@@ -1,229 +1,229 b'' | |||
|
1 | 1 | from __future__ import with_statement |
|
2 | 2 | import datetime |
|
3 | 3 | from rhodecode.tests.vcs.base import BackendTestMixin |
|
4 | 4 | from rhodecode.tests.vcs.conf import SCM_TESTS |
|
5 | 5 | from rhodecode.tests.vcs.conf import TEST_USER_CONFIG_FILE |
|
6 | 6 | from rhodecode.lib.vcs.nodes import FileNode |
|
7 | 7 | from rhodecode.lib.vcs.utils.compat import unittest |
|
8 | 8 | from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | class RepositoryBaseTest(BackendTestMixin): |
|
12 | 12 | recreate_repo_per_test = False |
|
13 | 13 | |
|
14 | 14 | @classmethod |
|
15 | 15 | def _get_commits(cls): |
|
16 | 16 | return super(RepositoryBaseTest, cls)._get_commits()[:1] |
|
17 | 17 | |
|
18 | 18 | def test_get_config_value(self): |
|
19 | 19 | self.assertEqual(self.repo.get_config_value('universal', 'foo', |
|
20 | 20 | TEST_USER_CONFIG_FILE), 'bar') |
|
21 | 21 | |
|
22 | 22 | def test_get_config_value_defaults_to_None(self): |
|
23 | 23 | self.assertEqual(self.repo.get_config_value('universal', 'nonexist', |
|
24 | 24 | TEST_USER_CONFIG_FILE), None) |
|
25 | 25 | |
|
26 | 26 | def test_get_user_name(self): |
|
27 | 27 | self.assertEqual(self.repo.get_user_name(TEST_USER_CONFIG_FILE), |
|
28 | 28 | 'Foo Bar') |
|
29 | 29 | |
|
30 | 30 | def test_get_user_email(self): |
|
31 | 31 | self.assertEqual(self.repo.get_user_email(TEST_USER_CONFIG_FILE), |
|
32 | 32 | 'foo.bar@example.com') |
|
33 | 33 | |
|
34 | 34 | def test_repo_equality(self): |
|
35 | 35 | self.assertTrue(self.repo == self.repo) |
|
36 | 36 | |
|
37 | 37 | def test_repo_equality_broken_object(self): |
|
38 | 38 | import copy |
|
39 | 39 | _repo = copy.copy(self.repo) |
|
40 | 40 | delattr(_repo, 'path') |
|
41 | 41 | self.assertTrue(self.repo != _repo) |
|
42 | 42 | |
|
43 | 43 | def test_repo_equality_other_object(self): |
|
44 | 44 | class dummy(object): |
|
45 | 45 | path = self.repo.path |
|
46 | 46 | self.assertTrue(self.repo != dummy()) |
|
47 | 47 | |
|
48 | 48 | |
|
49 | 49 | class RepositoryGetDiffTest(BackendTestMixin): |
|
50 | 50 | |
|
51 | 51 | @classmethod |
|
52 | 52 | def _get_commits(cls): |
|
53 | 53 | commits = [ |
|
54 | 54 | { |
|
55 | 55 | 'message': 'Initial commit', |
|
56 | 56 | 'author': 'Joe Doe <joe.doe@example.com>', |
|
57 | 57 | 'date': datetime.datetime(2010, 1, 1, 20), |
|
58 | 58 | 'added': [ |
|
59 | 59 | FileNode('foobar', content='foobar'), |
|
60 | 60 | FileNode('foobar2', content='foobar2'), |
|
61 | 61 | ], |
|
62 | 62 | }, |
|
63 | 63 | { |
|
64 | 64 | 'message': 'Changed foobar, added foobar3', |
|
65 | 65 | 'author': 'Jane Doe <jane.doe@example.com>', |
|
66 | 66 | 'date': datetime.datetime(2010, 1, 1, 21), |
|
67 | 67 | 'added': [ |
|
68 | 68 | FileNode('foobar3', content='foobar3'), |
|
69 | 69 | ], |
|
70 | 70 | 'changed': [ |
|
71 | 71 | FileNode('foobar', 'FOOBAR'), |
|
72 | 72 | ], |
|
73 | 73 | }, |
|
74 | 74 | { |
|
75 | 75 | 'message': 'Removed foobar, changed foobar3', |
|
76 | 76 | 'author': 'Jane Doe <jane.doe@example.com>', |
|
77 | 77 | 'date': datetime.datetime(2010, 1, 1, 22), |
|
78 | 78 | 'changed': [ |
|
79 | 79 | FileNode('foobar3', content='FOOBAR\nFOOBAR\nFOOBAR\n'), |
|
80 | 80 | ], |
|
81 | 81 | 'removed': [FileNode('foobar')], |
|
82 | 82 | }, |
|
83 | 83 | ] |
|
84 | 84 | return commits |
|
85 | 85 | |
|
86 | 86 | def test_raise_for_wrong(self): |
|
87 | 87 | with self.assertRaises(ChangesetDoesNotExistError): |
|
88 | 88 | self.repo.get_diff('a' * 40, 'b' * 40) |
|
89 | 89 | |
|
90 | 90 | |
|
91 | 91 | class GitRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase): |
|
92 | 92 | backend_alias = 'git' |
|
93 | 93 | |
|
94 | 94 | def test_initial_commit_diff(self): |
|
95 | 95 | initial_rev = self.repo.revisions[0] |
|
96 | 96 | self.assertEqual(self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev), '''diff --git a/foobar b/foobar |
|
97 | 97 | new file mode 100644 |
|
98 | 98 | index 0000000000000000000000000000000000000000..f6ea0495187600e7b2288c8ac19c5886383a4632 |
|
99 | 99 | --- /dev/null |
|
100 | 100 | +++ b/foobar |
|
101 | 101 | @@ -0,0 +1 @@ |
|
102 | 102 | +foobar |
|
103 | 103 | \ No newline at end of file |
|
104 | 104 | diff --git a/foobar2 b/foobar2 |
|
105 | 105 | new file mode 100644 |
|
106 | 106 | index 0000000000000000000000000000000000000000..e8c9d6b98e3dce993a464935e1a53f50b56a3783 |
|
107 | 107 | --- /dev/null |
|
108 | 108 | +++ b/foobar2 |
|
109 | 109 | @@ -0,0 +1 @@ |
|
110 | 110 | +foobar2 |
|
111 | 111 | \ No newline at end of file |
|
112 | 112 | ''') |
|
113 | 113 | |
|
114 | 114 | def test_second_changeset_diff(self): |
|
115 | 115 | revs = self.repo.revisions |
|
116 | 116 | self.assertEqual(self.repo.get_diff(revs[0], revs[1]), '''diff --git a/foobar b/foobar |
|
117 | 117 | index f6ea0495187600e7b2288c8ac19c5886383a4632..389865bb681b358c9b102d79abd8d5f941e96551 100644 |
|
118 | 118 | --- a/foobar |
|
119 | 119 | +++ b/foobar |
|
120 | 120 | @@ -1 +1 @@ |
|
121 | 121 | -foobar |
|
122 | 122 | \ No newline at end of file |
|
123 | 123 | +FOOBAR |
|
124 | 124 | \ No newline at end of file |
|
125 | 125 | diff --git a/foobar3 b/foobar3 |
|
126 | 126 | new file mode 100644 |
|
127 | 127 | index 0000000000000000000000000000000000000000..c11c37d41d33fb47741cff93fa5f9d798c1535b0 |
|
128 | 128 | --- /dev/null |
|
129 | 129 | +++ b/foobar3 |
|
130 | 130 | @@ -0,0 +1 @@ |
|
131 | 131 | +foobar3 |
|
132 | 132 | \ No newline at end of file |
|
133 | 133 | ''') |
|
134 | 134 | |
|
135 | 135 | def test_third_changeset_diff(self): |
|
136 | 136 | revs = self.repo.revisions |
|
137 | 137 | self.assertEqual(self.repo.get_diff(revs[1], revs[2]), '''diff --git a/foobar b/foobar |
|
138 | 138 | deleted file mode 100644 |
|
139 | 139 | index 389865bb681b358c9b102d79abd8d5f941e96551..0000000000000000000000000000000000000000 |
|
140 | 140 | --- a/foobar |
|
141 | 141 | +++ /dev/null |
|
142 | 142 | @@ -1 +0,0 @@ |
|
143 | 143 | -FOOBAR |
|
144 | 144 | \ No newline at end of file |
|
145 | 145 | diff --git a/foobar3 b/foobar3 |
|
146 | 146 | index c11c37d41d33fb47741cff93fa5f9d798c1535b0..f9324477362684ff692aaf5b9a81e01b9e9a671c 100644 |
|
147 | 147 | --- a/foobar3 |
|
148 | 148 | +++ b/foobar3 |
|
149 | 149 | @@ -1 +1,3 @@ |
|
150 | 150 | -foobar3 |
|
151 | 151 | \ No newline at end of file |
|
152 | 152 | +FOOBAR |
|
153 | 153 | +FOOBAR |
|
154 | 154 | +FOOBAR |
|
155 | 155 | ''') |
|
156 | 156 | |
|
157 | 157 | |
|
158 | 158 | class HgRepositoryGetDiffTest(RepositoryGetDiffTest, unittest.TestCase): |
|
159 | 159 | backend_alias = 'hg' |
|
160 | 160 | |
|
161 | 161 | def test_initial_commit_diff(self): |
|
162 | 162 | initial_rev = self.repo.revisions[0] |
|
163 | 163 | self.assertEqual(self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev), '''diff --git a/foobar b/foobar |
|
164 |
new file mode 100 |
|
|
164 | new file mode 100644 | |
|
165 | 165 | --- /dev/null |
|
166 | 166 | +++ b/foobar |
|
167 | 167 | @@ -0,0 +1,1 @@ |
|
168 | 168 | +foobar |
|
169 | 169 | \ No newline at end of file |
|
170 | 170 | diff --git a/foobar2 b/foobar2 |
|
171 |
new file mode 100 |
|
|
171 | new file mode 100644 | |
|
172 | 172 | --- /dev/null |
|
173 | 173 | +++ b/foobar2 |
|
174 | 174 | @@ -0,0 +1,1 @@ |
|
175 | 175 | +foobar2 |
|
176 | 176 | \ No newline at end of file |
|
177 | 177 | ''') |
|
178 | 178 | |
|
179 | 179 | def test_second_changeset_diff(self): |
|
180 | 180 | revs = self.repo.revisions |
|
181 | 181 | self.assertEqual(self.repo.get_diff(revs[0], revs[1]), '''diff --git a/foobar b/foobar |
|
182 | 182 | --- a/foobar |
|
183 | 183 | +++ b/foobar |
|
184 | 184 | @@ -1,1 +1,1 @@ |
|
185 | 185 | -foobar |
|
186 | 186 | \ No newline at end of file |
|
187 | 187 | +FOOBAR |
|
188 | 188 | \ No newline at end of file |
|
189 | 189 | diff --git a/foobar3 b/foobar3 |
|
190 |
new file mode 100 |
|
|
190 | new file mode 100644 | |
|
191 | 191 | --- /dev/null |
|
192 | 192 | +++ b/foobar3 |
|
193 | 193 | @@ -0,0 +1,1 @@ |
|
194 | 194 | +foobar3 |
|
195 | 195 | \ No newline at end of file |
|
196 | 196 | ''') |
|
197 | 197 | |
|
198 | 198 | def test_third_changeset_diff(self): |
|
199 | 199 | revs = self.repo.revisions |
|
200 | 200 | self.assertEqual(self.repo.get_diff(revs[1], revs[2]), '''diff --git a/foobar b/foobar |
|
201 |
deleted file mode 100 |
|
|
201 | deleted file mode 100644 | |
|
202 | 202 | --- a/foobar |
|
203 | 203 | +++ /dev/null |
|
204 | 204 | @@ -1,1 +0,0 @@ |
|
205 | 205 | -FOOBAR |
|
206 | 206 | \ No newline at end of file |
|
207 | 207 | diff --git a/foobar3 b/foobar3 |
|
208 | 208 | --- a/foobar3 |
|
209 | 209 | +++ b/foobar3 |
|
210 | 210 | @@ -1,1 +1,3 @@ |
|
211 | 211 | -foobar3 |
|
212 | 212 | \ No newline at end of file |
|
213 | 213 | +FOOBAR |
|
214 | 214 | +FOOBAR |
|
215 | 215 | +FOOBAR |
|
216 | 216 | ''') |
|
217 | 217 | |
|
218 | 218 | |
|
219 | 219 | # For each backend create test case class |
|
220 | 220 | for alias in SCM_TESTS: |
|
221 | 221 | attrs = { |
|
222 | 222 | 'backend_alias': alias, |
|
223 | 223 | } |
|
224 | 224 | cls_name = alias.capitalize() + RepositoryBaseTest.__name__ |
|
225 | 225 | bases = (RepositoryBaseTest, unittest.TestCase) |
|
226 | 226 | globals()[cls_name] = type(cls_name, bases, attrs) |
|
227 | 227 | |
|
228 | 228 | if __name__ == '__main__': |
|
229 | 229 | unittest.main() |
General Comments 0
You need to be logged in to leave comments.
Login now