Show More
@@ -1,250 +1,250 b'' | |||||
1 | from __future__ import with_statement |
|
1 | from __future__ import with_statement | |
2 | import os |
|
2 | import os | |
3 | from rhodecode.tests import * |
|
3 | from rhodecode.tests import * | |
4 | from rhodecode.lib.diffs import DiffProcessor, NEW_FILENODE, DEL_FILENODE, \ |
|
4 | from rhodecode.lib.diffs import DiffProcessor, NEW_FILENODE, DEL_FILENODE, \ | |
5 | MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE |
|
5 | MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE | |
6 |
|
6 | |||
7 | dn = os.path.dirname |
|
7 | dn = os.path.dirname | |
8 | FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'fixtures') |
|
8 | FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'fixtures') | |
9 |
|
9 | |||
10 | DIFF_FIXTURES = { |
|
10 | DIFF_FIXTURES = { | |
11 | 'hg_diff_add_single_binary_file.diff': [ |
|
11 | 'hg_diff_add_single_binary_file.diff': [ | |
12 | ('US Warszawa.jpg', 'A', |
|
12 | ('US Warszawa.jpg', 'A', | |
13 | {'added': 0, |
|
13 | {'added': 0, | |
14 | 'deleted': 0, |
|
14 | 'deleted': 0, | |
15 | 'binary': True, |
|
15 | 'binary': True, | |
16 | 'ops': {NEW_FILENODE: 'new file 100755', |
|
16 | 'ops': {NEW_FILENODE: 'new file 100755', | |
17 | BIN_FILENODE: 'binary diff not shown'}}), |
|
17 | BIN_FILENODE: 'binary diff not shown'}}), | |
18 | ], |
|
18 | ], | |
19 | 'hg_diff_mod_single_binary_file.diff': [ |
|
19 | 'hg_diff_mod_single_binary_file.diff': [ | |
20 | ('US Warszawa.jpg', 'M', |
|
20 | ('US Warszawa.jpg', 'M', | |
21 | {'added': 0, |
|
21 | {'added': 0, | |
22 | 'deleted': 0, |
|
22 | 'deleted': 0, | |
23 | 'binary': True, |
|
23 | 'binary': True, | |
24 | 'ops': {MOD_FILENODE: 'modified file', |
|
24 | 'ops': {MOD_FILENODE: 'modified file', | |
25 | BIN_FILENODE: 'binary diff not shown'}}), |
|
25 | BIN_FILENODE: 'binary diff not shown'}}), | |
26 | ], |
|
26 | ], | |
27 |
|
27 | |||
28 | 'hg_diff_mod_single_file_and_rename_and_chmod.diff': [ |
|
28 | 'hg_diff_mod_single_file_and_rename_and_chmod.diff': [ | |
29 | ('README', 'M', |
|
29 | ('README', 'M', | |
30 | {'added': 3, |
|
30 | {'added': 3, | |
31 | 'deleted': 0, |
|
31 | 'deleted': 0, | |
32 | 'binary': False, |
|
32 | 'binary': False, | |
33 | 'ops': {MOD_FILENODE: 'modified file', |
|
33 | 'ops': {MOD_FILENODE: 'modified file', | |
34 | RENAMED_FILENODE: 'file renamed from README.rst to README', |
|
34 | RENAMED_FILENODE: 'file renamed from README.rst to README', | |
35 | CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}), |
|
35 | CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}), | |
36 | ], |
|
36 | ], | |
37 |
'hg_diff_ |
|
37 | 'hg_diff_mod_file_and_rename.diff': [ | |
38 | ('README', 'M', |
|
38 | ('README.rst', 'M', | |
39 | {'added': 3, |
|
39 | {'added': 3, | |
40 | 'deleted': 0, |
|
40 | 'deleted': 0, | |
41 | 'binary': False, |
|
41 | 'binary': False, | |
42 | 'ops': {MOD_FILENODE: 'modified file', |
|
42 | 'ops': {MOD_FILENODE: 'modified file', | |
43 |
|
|
43 | RENAMED_FILENODE: 'file renamed from README to README.rst'}}), | |
44 | ], |
|
44 | ], | |
45 | 'hg_diff_del_single_binary_file.diff': [ |
|
45 | 'hg_diff_del_single_binary_file.diff': [ | |
46 | ('US Warszawa.jpg', 'D', |
|
46 | ('US Warszawa.jpg', 'D', | |
47 | {'added': 0, |
|
47 | {'added': 0, | |
48 | 'deleted': 0, |
|
48 | 'deleted': 0, | |
49 | 'binary': True, |
|
49 | 'binary': True, | |
50 | 'ops': {DEL_FILENODE: 'deleted file', |
|
50 | 'ops': {DEL_FILENODE: 'deleted file', | |
51 | BIN_FILENODE: 'binary diff not shown'}}), |
|
51 | BIN_FILENODE: 'binary diff not shown'}}), | |
52 | ], |
|
52 | ], | |
53 | 'hg_diff_chmod_and_mod_single_binary_file.diff': [ |
|
53 | 'hg_diff_chmod_and_mod_single_binary_file.diff': [ | |
54 | ('gravatar.png', 'M', |
|
54 | ('gravatar.png', 'M', | |
55 | {'added': 0, |
|
55 | {'added': 0, | |
56 | 'deleted': 0, |
|
56 | 'deleted': 0, | |
57 | 'binary': True, |
|
57 | 'binary': True, | |
58 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755', |
|
58 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755', | |
59 | BIN_FILENODE: 'binary diff not shown'}}), |
|
59 | BIN_FILENODE: 'binary diff not shown'}}), | |
60 | ], |
|
60 | ], | |
61 | 'hg_diff_chmod.diff': [ |
|
61 | 'hg_diff_chmod.diff': [ | |
62 | ('file', 'M', |
|
62 | ('file', 'M', | |
63 | {'added': 0, |
|
63 | {'added': 0, | |
64 | 'deleted': 0, |
|
64 | 'deleted': 0, | |
65 | 'binary': True, |
|
65 | 'binary': True, | |
66 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}), |
|
66 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}), | |
67 | ], |
|
67 | ], | |
68 | 'hg_diff_rename_file.diff': [ |
|
68 | 'hg_diff_rename_file.diff': [ | |
69 | ('file_renamed', 'M', |
|
69 | ('file_renamed', 'M', | |
70 | {'added': 0, |
|
70 | {'added': 0, | |
71 | 'deleted': 0, |
|
71 | 'deleted': 0, | |
72 | 'binary': True, |
|
72 | 'binary': True, | |
73 | 'ops': {RENAMED_FILENODE: 'file renamed from file to file_renamed'}}), |
|
73 | 'ops': {RENAMED_FILENODE: 'file renamed from file to file_renamed'}}), | |
74 | ], |
|
74 | ], | |
75 | 'hg_diff_rename_and_chmod_file.diff': [ |
|
75 | 'hg_diff_rename_and_chmod_file.diff': [ | |
76 | ('README', 'M', |
|
76 | ('README', 'M', | |
77 | {'added': 0, |
|
77 | {'added': 0, | |
78 | 'deleted': 0, |
|
78 | 'deleted': 0, | |
79 | 'binary': True, |
|
79 | 'binary': True, | |
80 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755', |
|
80 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755', | |
81 | RENAMED_FILENODE: 'file renamed from README.rst to README'}}), |
|
81 | RENAMED_FILENODE: 'file renamed from README.rst to README'}}), | |
82 | ], |
|
82 | ], | |
83 | 'hg_diff_binary_and_normal.diff': [ |
|
83 | 'hg_diff_binary_and_normal.diff': [ | |
84 | ('img/baseline-10px.png', 'A', |
|
84 | ('img/baseline-10px.png', 'A', | |
85 | {'added': 0, |
|
85 | {'added': 0, | |
86 | 'deleted': 0, |
|
86 | 'deleted': 0, | |
87 | 'binary': True, |
|
87 | 'binary': True, | |
88 | 'ops': {NEW_FILENODE: 'new file 100644', |
|
88 | 'ops': {NEW_FILENODE: 'new file 100644', | |
89 | BIN_FILENODE: 'binary diff not shown'}}), |
|
89 | BIN_FILENODE: 'binary diff not shown'}}), | |
90 | ('js/jquery/hashgrid.js', 'A', |
|
90 | ('js/jquery/hashgrid.js', 'A', | |
91 | {'added': 340, |
|
91 | {'added': 340, | |
92 | 'deleted': 0, |
|
92 | 'deleted': 0, | |
93 | 'binary': False, |
|
93 | 'binary': False, | |
94 | 'ops': {NEW_FILENODE: 'new file 100755'}}), |
|
94 | 'ops': {NEW_FILENODE: 'new file 100755'}}), | |
95 | ('index.html', 'M', |
|
95 | ('index.html', 'M', | |
96 | {'added': 3, |
|
96 | {'added': 3, | |
97 | 'deleted': 2, |
|
97 | 'deleted': 2, | |
98 | 'binary': False, |
|
98 | 'binary': False, | |
99 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
99 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
100 | ('less/docs.less', 'M', |
|
100 | ('less/docs.less', 'M', | |
101 | {'added': 34, |
|
101 | {'added': 34, | |
102 | 'deleted': 0, |
|
102 | 'deleted': 0, | |
103 | 'binary': False, |
|
103 | 'binary': False, | |
104 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
104 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
105 | ('less/scaffolding.less', 'M', |
|
105 | ('less/scaffolding.less', 'M', | |
106 | {'added': 1, |
|
106 | {'added': 1, | |
107 | 'deleted': 3, |
|
107 | 'deleted': 3, | |
108 | 'binary': False, |
|
108 | 'binary': False, | |
109 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
109 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
110 | ('readme.markdown', 'M', |
|
110 | ('readme.markdown', 'M', | |
111 | {'added': 1, |
|
111 | {'added': 1, | |
112 | 'deleted': 10, |
|
112 | 'deleted': 10, | |
113 | 'binary': False, |
|
113 | 'binary': False, | |
114 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
114 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
115 | ('img/baseline-20px.png', 'D', |
|
115 | ('img/baseline-20px.png', 'D', | |
116 | {'added': 0, |
|
116 | {'added': 0, | |
117 | 'deleted': 0, |
|
117 | 'deleted': 0, | |
118 | 'binary': True, |
|
118 | 'binary': True, | |
119 | 'ops': {DEL_FILENODE: 'deleted file', |
|
119 | 'ops': {DEL_FILENODE: 'deleted file', | |
120 | BIN_FILENODE: 'binary diff not shown'}}), |
|
120 | BIN_FILENODE: 'binary diff not shown'}}), | |
121 | ('js/global.js', 'D', |
|
121 | ('js/global.js', 'D', | |
122 | {'added': 0, |
|
122 | {'added': 0, | |
123 | 'deleted': 75, |
|
123 | 'deleted': 75, | |
124 | 'binary': False, |
|
124 | 'binary': False, | |
125 | 'ops': {DEL_FILENODE: 'deleted file'}}) |
|
125 | 'ops': {DEL_FILENODE: 'deleted file'}}) | |
126 | ], |
|
126 | ], | |
127 | 'git_diff_chmod.diff': [ |
|
127 | 'git_diff_chmod.diff': [ | |
128 | ('work-horus.xls', 'M', |
|
128 | ('work-horus.xls', 'M', | |
129 | {'added': 0, |
|
129 | {'added': 0, | |
130 | 'deleted': 0, |
|
130 | 'deleted': 0, | |
131 | 'binary': True, |
|
131 | 'binary': True, | |
132 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755'}}) |
|
132 | 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755'}}) | |
133 | ], |
|
133 | ], | |
134 | 'git_diff_rename_file.diff': [ |
|
134 | 'git_diff_rename_file.diff': [ | |
135 | ('file.xls', 'M', |
|
135 | ('file.xls', 'M', | |
136 | {'added': 0, |
|
136 | {'added': 0, | |
137 | 'deleted': 0, |
|
137 | 'deleted': 0, | |
138 | 'binary': True, |
|
138 | 'binary': True, | |
139 | 'ops': {RENAMED_FILENODE: 'file renamed from work-horus.xls to file.xls'}}) |
|
139 | 'ops': {RENAMED_FILENODE: 'file renamed from work-horus.xls to file.xls'}}) | |
140 | ], |
|
140 | ], | |
141 | 'git_diff_mod_single_binary_file.diff': [ |
|
141 | 'git_diff_mod_single_binary_file.diff': [ | |
142 | ('US Warszawa.jpg', 'M', |
|
142 | ('US Warszawa.jpg', 'M', | |
143 | {'added': 0, |
|
143 | {'added': 0, | |
144 | 'deleted': 0, |
|
144 | 'deleted': 0, | |
145 | 'binary': True, |
|
145 | 'binary': True, | |
146 | 'ops': {MOD_FILENODE: 'modified file', |
|
146 | 'ops': {MOD_FILENODE: 'modified file', | |
147 | BIN_FILENODE: 'binary diff not shown'}}) |
|
147 | BIN_FILENODE: 'binary diff not shown'}}) | |
148 | ], |
|
148 | ], | |
149 | 'git_diff_binary_and_normal.diff': [ |
|
149 | 'git_diff_binary_and_normal.diff': [ | |
150 | ('img/baseline-10px.png', 'A', |
|
150 | ('img/baseline-10px.png', 'A', | |
151 | {'added': 0, |
|
151 | {'added': 0, | |
152 | 'deleted': 0, |
|
152 | 'deleted': 0, | |
153 | 'binary': True, |
|
153 | 'binary': True, | |
154 | 'ops': {NEW_FILENODE: 'new file 100644', |
|
154 | 'ops': {NEW_FILENODE: 'new file 100644', | |
155 | BIN_FILENODE: 'binary diff not shown'}}), |
|
155 | BIN_FILENODE: 'binary diff not shown'}}), | |
156 | ('js/jquery/hashgrid.js', 'A', |
|
156 | ('js/jquery/hashgrid.js', 'A', | |
157 | {'added': 340, |
|
157 | {'added': 340, | |
158 | 'deleted': 0, |
|
158 | 'deleted': 0, | |
159 | 'binary': False, |
|
159 | 'binary': False, | |
160 | 'ops': {NEW_FILENODE: 'new file 100755'}}), |
|
160 | 'ops': {NEW_FILENODE: 'new file 100755'}}), | |
161 | ('index.html', 'M', |
|
161 | ('index.html', 'M', | |
162 | {'added': 3, |
|
162 | {'added': 3, | |
163 | 'deleted': 2, |
|
163 | 'deleted': 2, | |
164 | 'binary': False, |
|
164 | 'binary': False, | |
165 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
165 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
166 | ('less/docs.less', 'M', |
|
166 | ('less/docs.less', 'M', | |
167 | {'added': 34, |
|
167 | {'added': 34, | |
168 | 'deleted': 0, |
|
168 | 'deleted': 0, | |
169 | 'binary': False, |
|
169 | 'binary': False, | |
170 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
170 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
171 | ('less/scaffolding.less', 'M', |
|
171 | ('less/scaffolding.less', 'M', | |
172 | {'added': 1, |
|
172 | {'added': 1, | |
173 | 'deleted': 3, |
|
173 | 'deleted': 3, | |
174 | 'binary': False, |
|
174 | 'binary': False, | |
175 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
175 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
176 | ('readme.markdown', 'M', |
|
176 | ('readme.markdown', 'M', | |
177 | {'added': 1, |
|
177 | {'added': 1, | |
178 | 'deleted': 10, |
|
178 | 'deleted': 10, | |
179 | 'binary': False, |
|
179 | 'binary': False, | |
180 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
180 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
181 | ('img/baseline-20px.png', 'D', |
|
181 | ('img/baseline-20px.png', 'D', | |
182 | {'added': 0, |
|
182 | {'added': 0, | |
183 | 'deleted': 0, |
|
183 | 'deleted': 0, | |
184 | 'binary': True, |
|
184 | 'binary': True, | |
185 | 'ops': {DEL_FILENODE: 'deleted file', |
|
185 | 'ops': {DEL_FILENODE: 'deleted file', | |
186 | BIN_FILENODE: 'binary diff not shown'}}), |
|
186 | BIN_FILENODE: 'binary diff not shown'}}), | |
187 | ('js/global.js', 'D', |
|
187 | ('js/global.js', 'D', | |
188 | {'added': 0, |
|
188 | {'added': 0, | |
189 | 'deleted': 75, |
|
189 | 'deleted': 75, | |
190 | 'binary': False, |
|
190 | 'binary': False, | |
191 | 'ops': {DEL_FILENODE: 'deleted file'}}), |
|
191 | 'ops': {DEL_FILENODE: 'deleted file'}}), | |
192 | ], |
|
192 | ], | |
193 | 'diff_with_diff_data.diff': [ |
|
193 | 'diff_with_diff_data.diff': [ | |
194 | ('vcs/backends/base.py', 'M', |
|
194 | ('vcs/backends/base.py', 'M', | |
195 | {'added': 18, |
|
195 | {'added': 18, | |
196 | 'deleted': 2, |
|
196 | 'deleted': 2, | |
197 | 'binary': False, |
|
197 | 'binary': False, | |
198 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
198 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
199 | ('vcs/backends/git/repository.py', 'M', |
|
199 | ('vcs/backends/git/repository.py', 'M', | |
200 | {'added': 46, |
|
200 | {'added': 46, | |
201 | 'deleted': 15, |
|
201 | 'deleted': 15, | |
202 | 'binary': False, |
|
202 | 'binary': False, | |
203 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
203 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
204 | ('vcs/backends/hg.py', 'M', |
|
204 | ('vcs/backends/hg.py', 'M', | |
205 | {'added': 22, |
|
205 | {'added': 22, | |
206 | 'deleted': 3, |
|
206 | 'deleted': 3, | |
207 | 'binary': False, |
|
207 | 'binary': False, | |
208 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
208 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
209 | ('vcs/tests/test_git.py', 'M', |
|
209 | ('vcs/tests/test_git.py', 'M', | |
210 | {'added': 5, |
|
210 | {'added': 5, | |
211 | 'deleted': 5, |
|
211 | 'deleted': 5, | |
212 | 'binary': False, |
|
212 | 'binary': False, | |
213 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
213 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
214 | ('vcs/tests/test_repository.py', 'M', |
|
214 | ('vcs/tests/test_repository.py', 'M', | |
215 | {'added': 174, |
|
215 | {'added': 174, | |
216 | 'deleted': 2, |
|
216 | 'deleted': 2, | |
217 | 'binary': False, |
|
217 | 'binary': False, | |
218 | 'ops': {MOD_FILENODE: 'modified file'}}), |
|
218 | 'ops': {MOD_FILENODE: 'modified file'}}), | |
219 | ], |
|
219 | ], | |
220 | # 'large_diff.diff': [ |
|
220 | # 'large_diff.diff': [ | |
221 | # ('.hgignore', 'A', {'deleted': 0, 'binary': False, 'added': 3, 'ops': {1: 'new file 100644'}}), |
|
221 | # ('.hgignore', 'A', {'deleted': 0, 'binary': False, 'added': 3, 'ops': {1: 'new file 100644'}}), | |
222 | # ('MANIFEST.in', 'A', {'deleted': 0, 'binary': False, 'added': 3, 'ops': {1: 'new file 100644'}}), |
|
222 | # ('MANIFEST.in', 'A', {'deleted': 0, 'binary': False, 'added': 3, 'ops': {1: 'new file 100644'}}), | |
223 | # ('README.txt', 'A', {'deleted': 0, 'binary': False, 'added': 19, 'ops': {1: 'new file 100644'}}), |
|
223 | # ('README.txt', 'A', {'deleted': 0, 'binary': False, 'added': 19, 'ops': {1: 'new file 100644'}}), | |
224 | # ('development.ini', 'A', {'deleted': 0, 'binary': False, 'added': 116, 'ops': {1: 'new file 100644'}}), |
|
224 | # ('development.ini', 'A', {'deleted': 0, 'binary': False, 'added': 116, 'ops': {1: 'new file 100644'}}), | |
225 | # ('docs/index.txt', 'A', {'deleted': 0, 'binary': False, 'added': 19, 'ops': {1: 'new file 100644'}}), |
|
225 | # ('docs/index.txt', 'A', {'deleted': 0, 'binary': False, 'added': 19, 'ops': {1: 'new file 100644'}}), | |
226 | # ('ez_setup.py', 'A', {'deleted': 0, 'binary': False, 'added': 276, 'ops': {1: 'new file 100644'}}), |
|
226 | # ('ez_setup.py', 'A', {'deleted': 0, 'binary': False, 'added': 276, 'ops': {1: 'new file 100644'}}), | |
227 | # ('hgapp.py', 'A', {'deleted': 0, 'binary': False, 'added': 26, 'ops': {1: 'new file 100644'}}), |
|
227 | # ('hgapp.py', 'A', {'deleted': 0, 'binary': False, 'added': 26, 'ops': {1: 'new file 100644'}}), | |
228 | # ('hgwebdir.config', 'A', {'deleted': 0, 'binary': False, 'added': 21, 'ops': {1: 'new file 100644'}}), |
|
228 | # ('hgwebdir.config', 'A', {'deleted': 0, 'binary': False, 'added': 21, 'ops': {1: 'new file 100644'}}), | |
229 | # ('pylons_app.egg-info/PKG-INFO', 'A', {'deleted': 0, 'binary': False, 'added': 10, 'ops': {1: 'new file 100644'}}), |
|
229 | # ('pylons_app.egg-info/PKG-INFO', 'A', {'deleted': 0, 'binary': False, 'added': 10, 'ops': {1: 'new file 100644'}}), | |
230 | # ('pylons_app.egg-info/SOURCES.txt', 'A', {'deleted': 0, 'binary': False, 'added': 33, 'ops': {1: 'new file 100644'}}), |
|
230 | # ('pylons_app.egg-info/SOURCES.txt', 'A', {'deleted': 0, 'binary': False, 'added': 33, 'ops': {1: 'new file 100644'}}), | |
231 | # ('pylons_app.egg-info/dependency_links.txt', 'A', {'deleted': 0, 'binary': False, 'added': 1, 'ops': {1: 'new file 100644'}}), |
|
231 | # ('pylons_app.egg-info/dependency_links.txt', 'A', {'deleted': 0, 'binary': False, 'added': 1, 'ops': {1: 'new file 100644'}}), | |
232 | # #TODO: |
|
232 | # #TODO: | |
233 | # ], |
|
233 | # ], | |
234 |
|
234 | |||
235 | } |
|
235 | } | |
236 |
|
236 | |||
237 |
|
237 | |||
238 | class DiffLibTest(BaseTestCase): |
|
238 | class DiffLibTest(BaseTestCase): | |
239 |
|
239 | |||
240 | @parameterized.expand([(x,) for x in DIFF_FIXTURES]) |
|
240 | @parameterized.expand([(x,) for x in DIFF_FIXTURES]) | |
241 | def test_diff(self, diff_fixture): |
|
241 | def test_diff(self, diff_fixture): | |
242 |
|
242 | |||
243 | with open(os.path.join(FIXTURES, diff_fixture)) as f: |
|
243 | with open(os.path.join(FIXTURES, diff_fixture)) as f: | |
244 | diff = f.read() |
|
244 | diff = f.read() | |
245 |
|
245 | |||
246 | diff_proc = DiffProcessor(diff) |
|
246 | diff_proc = DiffProcessor(diff) | |
247 | diff_proc_d = diff_proc.prepare() |
|
247 | diff_proc_d = diff_proc.prepare() | |
248 | data = [(x['filename'], x['operation'], x['stats']) for x in diff_proc_d] |
|
248 | data = [(x['filename'], x['operation'], x['stats']) for x in diff_proc_d] | |
249 | expected_data = DIFF_FIXTURES[diff_fixture] |
|
249 | expected_data = DIFF_FIXTURES[diff_fixture] | |
250 | self.assertListEqual(expected_data, data) |
|
250 | self.assertListEqual(expected_data, data) |
General Comments 0
You need to be logged in to leave comments.
Login now