##// END OF EJS Templates
tests: fixed tests for helpers.
marcink -
r273:c45a42ca default
parent child Browse files
Show More
@@ -84,8 +84,12 b' def test_process_patterns_repo(backend, '
84 84 'pref': '#',
85 85 }
86 86 }
87
88 def get_settings_mock(self, cache=True):
89 return config
90
87 91 with mock.patch.object(IssueTrackerSettingsModel,
88 'get_settings', lambda s: config):
92 'get_settings', get_settings_mock):
89 93 processed_text = helpers.process_patterns(
90 94 text_string, repo.repo_name, config)
91 95
@@ -106,8 +110,12 b' def test_process_patterns_no_repo(text_s'
106 110 'pref': '#',
107 111 }
108 112 }
113
114 def get_settings_mock(self, cache=True):
115 return config
116
109 117 with mock.patch.object(IssueTrackerSettingsModel,
110 'get_global_settings', lambda s, cache: config):
118 'get_global_settings', get_settings_mock):
111 119 processed_text = helpers.process_patterns(
112 120 text_string, '', config)
113 121
@@ -126,8 +134,12 b' def test_process_patterns_non_existent_r'
126 134 'pref': '#',
127 135 }
128 136 }
137
138 def get_settings_mock(self, cache=True):
139 return config
140
129 141 with mock.patch.object(IssueTrackerSettingsModel,
130 'get_global_settings', lambda s, cache: config):
142 'get_global_settings', get_settings_mock):
131 143 processed_text = helpers.process_patterns(
132 144 text_string, 'do-not-exist', config)
133 145
@@ -182,10 +194,12 b' def test_get_matching_offsets(test_text,'
182 194 assert helpers.get_matching_offsets(
183 195 test_text, text_phrases) == expected_output
184 196
197
185 198 def test_normalize_text_for_matching():
186 199 assert helpers.normalize_text_for_matching(
187 200 'OJjfe)*#$*@)$JF*)3r2f80h') == 'ojjfe jf 3r2f80h'
188 201
202
189 203 def test_get_matching_line_offsets():
190 204 assert helpers.get_matching_line_offsets([
191 205 'words words words',
@@ -193,4 +207,4 b' def test_get_matching_line_offsets():'
193 207 'some text some',
194 208 'words words words',
195 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