Show More
@@ -84,8 +84,12 b' def test_process_patterns_repo(backend, ' | |||||
84 | 'pref': '#', |
|
84 | 'pref': '#', | |
85 | } |
|
85 | } | |
86 | } |
|
86 | } | |
|
87 | ||||
|
88 | def get_settings_mock(self, cache=True): | |||
|
89 | return config | |||
|
90 | ||||
87 | with mock.patch.object(IssueTrackerSettingsModel, |
|
91 | with mock.patch.object(IssueTrackerSettingsModel, | |
88 |
'get_settings', |
|
92 | 'get_settings', get_settings_mock): | |
89 | processed_text = helpers.process_patterns( |
|
93 | processed_text = helpers.process_patterns( | |
90 | text_string, repo.repo_name, config) |
|
94 | text_string, repo.repo_name, config) | |
91 |
|
95 | |||
@@ -106,8 +110,12 b' def test_process_patterns_no_repo(text_s' | |||||
106 | 'pref': '#', |
|
110 | 'pref': '#', | |
107 | } |
|
111 | } | |
108 | } |
|
112 | } | |
|
113 | ||||
|
114 | def get_settings_mock(self, cache=True): | |||
|
115 | return config | |||
|
116 | ||||
109 | with mock.patch.object(IssueTrackerSettingsModel, |
|
117 | with mock.patch.object(IssueTrackerSettingsModel, | |
110 |
'get_global_settings', |
|
118 | 'get_global_settings', get_settings_mock): | |
111 | processed_text = helpers.process_patterns( |
|
119 | processed_text = helpers.process_patterns( | |
112 | text_string, '', config) |
|
120 | text_string, '', config) | |
113 |
|
121 | |||
@@ -126,8 +134,12 b' def test_process_patterns_non_existent_r' | |||||
126 | 'pref': '#', |
|
134 | 'pref': '#', | |
127 | } |
|
135 | } | |
128 | } |
|
136 | } | |
|
137 | ||||
|
138 | def get_settings_mock(self, cache=True): | |||
|
139 | return config | |||
|
140 | ||||
129 | with mock.patch.object(IssueTrackerSettingsModel, |
|
141 | with mock.patch.object(IssueTrackerSettingsModel, | |
130 |
'get_global_settings', |
|
142 | 'get_global_settings', get_settings_mock): | |
131 | processed_text = helpers.process_patterns( |
|
143 | processed_text = helpers.process_patterns( | |
132 | text_string, 'do-not-exist', config) |
|
144 | text_string, 'do-not-exist', config) | |
133 |
|
145 | |||
@@ -182,10 +194,12 b' def test_get_matching_offsets(test_text,' | |||||
182 | assert helpers.get_matching_offsets( |
|
194 | assert helpers.get_matching_offsets( | |
183 | test_text, text_phrases) == expected_output |
|
195 | test_text, text_phrases) == expected_output | |
184 |
|
196 | |||
|
197 | ||||
185 | def test_normalize_text_for_matching(): |
|
198 | def test_normalize_text_for_matching(): | |
186 | assert helpers.normalize_text_for_matching( |
|
199 | assert helpers.normalize_text_for_matching( | |
187 | 'OJjfe)*#$*@)$JF*)3r2f80h') == 'ojjfe jf 3r2f80h' |
|
200 | 'OJjfe)*#$*@)$JF*)3r2f80h') == 'ojjfe jf 3r2f80h' | |
188 |
|
201 | |||
|
202 | ||||
189 | def test_get_matching_line_offsets(): |
|
203 | def test_get_matching_line_offsets(): | |
190 | assert helpers.get_matching_line_offsets([ |
|
204 | assert helpers.get_matching_line_offsets([ | |
191 | 'words words words', |
|
205 | 'words words words', | |
@@ -193,4 +207,4 b' def test_get_matching_line_offsets():' | |||||
193 | 'some text some', |
|
207 | 'some text some', | |
194 | 'words words words', |
|
208 | 'words words words', | |
195 | 'words words words', |
|
209 | 'words words words', | |
196 | 'text here what'], 'text') == {3: [(5, 9)], 6: [(0, 4)]} No newline at end of file |
|
210 | 'text here what'], 'text') == {3: [(5, 9)], 6: [(0, 4)]} |
General Comments 0
You need to be logged in to leave comments.
Login now