Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: Tools/Scripts/webkitpy/common/config/committers_unittest.py

Issue 17639006: Remove committer list, bugzilla, watchlist code and transitive closure of stuff. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merge on top of thakis' change in r153020 Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (C) 2009 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer # in th e documentation and/or other materials provided with the
11 # distribution.
12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived from
14 # this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 import unittest2 as unittest
29 from webkitpy.common.config.committers import Account, CommitterList, Contributo r, Committer, Reviewer
30
31 class CommittersTest(unittest.TestCase):
32 def test_committer_lookup(self):
33 account = Account('Test Zero', ['zero@test.com', 'zero@gmail.com'], 'zer o')
34 committer = Committer('Test One', 'one@test.com', 'one')
35 reviewer = Reviewer('Test Two', ['two@test.com', 'Two@rad.com', 'so_two@ gmail.com'])
36 contributor = Contributor('Test Three', ['Three@test.com'], 'three')
37 contributor_with_two_nicknames = Contributor('Other Four', ['otherfour@w ebkit.org', 'otherfour@webkit2.org'], ['four', 'otherfour'])
38 contributor_with_same_email_username = Contributor('Yet Another Four', [ 'otherfour@webkit.com'], ['yetanotherfour'])
39 committer_list = CommitterList(watchers=[account], committers=[committer ], reviewers=[reviewer],
40 contributors=[contributor, contributor_with_two_nicknames, contribut or_with_same_email_username])
41
42 # Test valid committer, reviewer and contributor lookup
43 self.assertEqual(committer_list.account_by_email('zero@test.com'), accou nt)
44 self.assertEqual(committer_list.committer_by_email('one@test.com'), comm itter)
45 self.assertEqual(committer_list.reviewer_by_email('two@test.com'), revie wer)
46 self.assertEqual(committer_list.committer_by_email('two@test.com'), revi ewer)
47 self.assertEqual(committer_list.committer_by_email('two@rad.com'), revie wer)
48 self.assertEqual(committer_list.reviewer_by_email('so_two@gmail.com'), r eviewer)
49 self.assertEqual(committer_list.contributor_by_email('three@test.com'), contributor)
50
51 # Test valid committer, reviewer and contributor lookup
52 self.assertEqual(committer_list.committer_by_name("Test One"), committer )
53 self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
54 self.assertIsNone(committer_list.committer_by_name("Test Three"))
55 self.assertEqual(committer_list.contributor_by_name("Test Three"), contr ibutor)
56 self.assertEqual(committer_list.contributor_by_name("test one"), committ er)
57 self.assertEqual(committer_list.contributor_by_name("test two"), reviewe r)
58 self.assertEqual(committer_list.contributor_by_name("test three"), contr ibutor)
59
60 # Test that the first email is assumed to be the Bugzilla email address (for now)
61 self.assertEqual(committer_list.committer_by_email('two@rad.com').bugzil la_email(), 'two@test.com')
62
63 # Test lookup by login email address
64 self.assertEqual(committer_list.account_by_login('zero@test.com'), accou nt)
65 self.assertIsNone(committer_list.account_by_login('zero@gmail.com'))
66 self.assertEqual(committer_list.account_by_login('one@test.com'), commit ter)
67 self.assertEqual(committer_list.account_by_login('two@test.com'), review er)
68 self.assertIsNone(committer_list.account_by_login('Two@rad.com'))
69 self.assertIsNone(committer_list.account_by_login('so_two@gmail.com'))
70
71 # Test that a known committer is not returned during reviewer lookup
72 self.assertIsNone(committer_list.reviewer_by_email('one@test.com'))
73 self.assertIsNone(committer_list.reviewer_by_email('three@test.com'))
74 # and likewise that a known contributor is not returned for committer lo okup.
75 self.assertIsNone(committer_list.committer_by_email('three@test.com'))
76
77 # Test that unknown email address fail both committer and reviewer looku p
78 self.assertIsNone(committer_list.committer_by_email('bar@bar.com'))
79 self.assertIsNone(committer_list.reviewer_by_email('bar@bar.com'))
80
81 # Test that emails returns a list.
82 self.assertEqual(committer.emails, ['one@test.com'])
83
84 self.assertEqual(committer.irc_nicknames, ['one'])
85 self.assertEqual(committer_list.contributor_by_irc_nickname('one'), comm itter)
86 self.assertEqual(committer_list.contributor_by_irc_nickname('three'), co ntributor)
87 self.assertEqual(committer_list.contributor_by_irc_nickname('four'), con tributor_with_two_nicknames)
88 self.assertEqual(committer_list.contributor_by_irc_nickname('otherfour') , contributor_with_two_nicknames)
89
90 # Test that the lists returned are are we expect them.
91 self.assertEqual(committer_list.contributors(), [contributor, contributo r_with_two_nicknames, contributor_with_same_email_username, committer, reviewer] )
92 self.assertEqual(committer_list.committers(), [committer, reviewer])
93 self.assertEqual(committer_list.reviewers(), [reviewer])
94
95 self.assertEqual(committer_list.contributors_by_search_string('test'), [ contributor, committer, reviewer])
96 self.assertEqual(committer_list.contributors_by_search_string('rad'), [r eviewer])
97 self.assertEqual(committer_list.contributors_by_search_string('Two'), [r eviewer])
98 self.assertEqual(committer_list.contributors_by_search_string('otherfour '), [contributor_with_two_nicknames])
99 self.assertEqual(committer_list.contributors_by_search_string('*otherfou r*'), [contributor_with_two_nicknames, contributor_with_same_email_username])
100
101 self.assertEqual(committer_list.contributors_by_email_username("one"), [ committer])
102 self.assertEqual(committer_list.contributors_by_email_username("four"), [])
103 self.assertEqual(committer_list.contributors_by_email_username("otherfou r"), [contributor_with_two_nicknames, contributor_with_same_email_username])
104
105 def _assert_fuzz_match(self, text, name_of_expected_contributor, expected_di stance):
106 committers = CommitterList()
107 contributors, distance = committers.contributors_by_fuzzy_match(text)
108 if type(name_of_expected_contributor) is list:
109 expected_names = name_of_expected_contributor
110 else:
111 expected_names = [name_of_expected_contributor] if name_of_expected_ contributor else []
112 self.assertEqual(([contributor.full_name for contributor in contributors ], distance), (expected_names, expected_distance))
113
114 # Basic testing of the edit distance matching ...
115 def test_contributors_by_fuzzy_match(self):
116 self._assert_fuzz_match('Geoff Garen', 'Geoffrey Garen', 3)
117 self._assert_fuzz_match('Kenneth Christiansen', 'Kenneth Rohde Christian sen', 6)
118 self._assert_fuzz_match('Sam', 'Sam Weinig', 0)
119 self._assert_fuzz_match('me', None, 2)
120
121 # The remaining tests test that certain names are resolved in a specific way .
122 # We break this up into multiple tests so that each is faster and they can
123 # be run in parallel. Unfortunately each test scans the entire committers li st,
124 # so these are inherently slow (see https://bugs.webkit.org/show_bug.cgi?id= 79179).
125 #
126 # Commented out lines are test cases imported from the bug 26533 yet to pass .
127
128 def integration_test_contributors__none(self):
129 self._assert_fuzz_match('myself', None, 6)
130 self._assert_fuzz_match('others', None, 6)
131 self._assert_fuzz_match('BUILD FIX', None, 9)
132
133 def integration_test_contributors__none_2(self):
134 self._assert_fuzz_match('but Dan Bernstein also reviewed', None, 31)
135 self._assert_fuzz_match('asked thoughtful questions', None, 26)
136 self._assert_fuzz_match('build fix of mac', None, 16)
137
138 def integration_test_contributors__none_3(self):
139 self._assert_fuzz_match('a spell checker', None, 15)
140 self._assert_fuzz_match('nobody, build fix', None, 17)
141 self._assert_fuzz_match('NOBODY (chromium build fix)', None, 27)
142
143 def integration_test_contributors_ada_chan(self):
144 self._assert_fuzz_match('Ada', 'Ada Chan', 0)
145
146 def integration_test_contributors_adele_peterson(self):
147 self._assert_fuzz_match('adele', 'Adele Peterson', 0)
148
149 def integration_test_contributors_adele_peterson(self):
150 # self._assert_fuzz_match('Adam', 'Adam Roben', 0)
151 self._assert_fuzz_match('aroben', 'Adam Roben', 0)
152
153 def integration_test_contributors_alexey_proskuryakov(self):
154 # self._assert_fuzz_match('Alexey', 'Alexey Proskuryakov', 0)
155 self._assert_fuzz_match('ap', 'Alexey Proskuryakov', 0)
156 self._assert_fuzz_match('Alexey P', 'Alexey Proskuryakov', 0)
157
158 def integration_test_contributors_alice_liu(self):
159 # self._assert_fuzz_match('Alice', 'Alice Liu', 0)
160 self._assert_fuzz_match('aliu', 'Alice Liu', 0)
161 self._assert_fuzz_match('Liu', 'Alice Liu', 0)
162
163 def integration_test_contributors_alp_toker(self):
164 self._assert_fuzz_match('Alp', 'Alp Toker', 0)
165
166 def integration_test_contributors_anders_carlsson(self):
167 self._assert_fuzz_match('Anders', 'Anders Carlsson', 0)
168 self._assert_fuzz_match('andersca', 'Anders Carlsson', 0)
169 self._assert_fuzz_match('anders', 'Anders Carlsson', 0)
170 self._assert_fuzz_match('Andersca', 'Anders Carlsson', 0)
171
172 def integration_test_contributors_antti_koivisto(self):
173 self._assert_fuzz_match('Antti "printf" Koivisto', 'Antti Koivisto', 9)
174 self._assert_fuzz_match('Antti', 'Antti Koivisto', 0)
175
176 def integration_test_contributors_beth_dakin(self):
177 self._assert_fuzz_match('Beth', 'Beth Dakin', 0)
178 self._assert_fuzz_match('beth', 'Beth Dakin', 0)
179 self._assert_fuzz_match('bdakin', 'Beth Dakin', 0)
180
181 def integration_test_contributors_brady_eidson(self):
182 self._assert_fuzz_match('Brady', 'Brady Eidson', 0)
183 self._assert_fuzz_match('bradee-oh', 'Brady Eidson', 0)
184 self._assert_fuzz_match('Brady', 'Brady Eidson', 0)
185
186 def integration_test_contributors_cameron_zwarich(self):
187 pass # self._assert_fuzz_match('Cameron', 'Cameron Zwarich', 0)
188 # self._assert_fuzz_match('cpst', 'Cameron Zwarich', 1)
189
190 def integration_test_contributors_chris_blumenberg(self):
191 # self._assert_fuzz_match('Chris', 'Chris Blumenberg', 0)
192 self._assert_fuzz_match('cblu', 'Chris Blumenberg', 0)
193
194 def integration_test_contributors_dan_bernstein(self):
195 self._assert_fuzz_match('Dan', ['Dan Winship', 'Dan Bernstein'], 0)
196 self._assert_fuzz_match('Dan B', 'Dan Bernstein', 0)
197 # self._assert_fuzz_match('mitz', 'Dan Bernstein', 0)
198 self._assert_fuzz_match('Mitz Pettel', 'Dan Bernstein', 1)
199 self._assert_fuzz_match('Mitzpettel', 'Dan Bernstein', 0)
200 self._assert_fuzz_match('Mitz Pettel RTL', 'Dan Bernstein', 5)
201
202 def integration_test_contributors_dan_bernstein_2(self):
203 self._assert_fuzz_match('Teh Mitzpettel', 'Dan Bernstein', 4)
204 # self._assert_fuzz_match('The Mitz', 'Dan Bernstein', 0)
205 self._assert_fuzz_match('Dr Dan Bernstein', 'Dan Bernstein', 3)
206
207 def integration_test_contributors_darin_adler(self):
208 self._assert_fuzz_match('Darin Adler\'', 'Darin Adler', 1)
209 self._assert_fuzz_match('Darin', 'Darin Adler', 0) # Thankfully "Fisher " is longer than "Adler"
210 self._assert_fuzz_match('darin', 'Darin Adler', 0)
211
212 def integration_test_contributors_david_harrison(self):
213 self._assert_fuzz_match('Dave Harrison', 'David Harrison', 2)
214 self._assert_fuzz_match('harrison', 'David Harrison', 0)
215 self._assert_fuzz_match('Dr. Harrison', 'David Harrison', 4)
216
217 def integration_test_contributors_david_harrison_2(self):
218 self._assert_fuzz_match('Dave Harrson', 'David Harrison', 3)
219 self._assert_fuzz_match('Dave Harrsion', 'David Harrison', 4) # Damerau -Levenshtein distance is 3
220
221 def integration_test_contributors_david_hyatt(self):
222 self._assert_fuzz_match('Dave Hyatt', 'David Hyatt', 2)
223 self._assert_fuzz_match('Daddy Hyatt', 'David Hyatt', 3)
224 # self._assert_fuzz_match('Dave', 'David Hyatt', 0) # 'Dave' could mean harrison.
225 self._assert_fuzz_match('hyatt', 'David Hyatt', 0)
226 # self._assert_fuzz_match('Haytt', 'David Hyatt', 0) # Works if we had implemented Damerau-Levenshtein distance!
227
228 def integration_test_contributors_david_kilzer(self):
229 self._assert_fuzz_match('Dave Kilzer', 'David Kilzer', 2)
230 self._assert_fuzz_match('David D. Kilzer', 'David Kilzer', 3)
231 self._assert_fuzz_match('ddkilzer', 'David Kilzer', 0)
232
233 def integration_test_contributors_don_melton(self):
234 self._assert_fuzz_match('Don', 'Don Melton', 0)
235 self._assert_fuzz_match('Gramps', 'Don Melton', 0)
236
237 def integration_test_contributors_eric_seidel(self):
238 # self._assert_fuzz_match('eric', 'Eric Seidel', 0)
239 self._assert_fuzz_match('Eric S', 'Eric Seidel', 0)
240 # self._assert_fuzz_match('MacDome', 'Eric Seidel', 0)
241 self._assert_fuzz_match('eseidel', 'Eric Seidel', 0)
242
243 def integration_test_contributors_geoffrey_garen(self):
244 # self._assert_fuzz_match('Geof', 'Geoffrey Garen', 4)
245 # self._assert_fuzz_match('Geoff', 'Geoffrey Garen', 3)
246 self._assert_fuzz_match('Geoff Garen', 'Geoffrey Garen', 3)
247 self._assert_fuzz_match('ggaren', 'Geoffrey Garen', 0)
248 # self._assert_fuzz_match('geoff', 'Geoffrey Garen', 0)
249 self._assert_fuzz_match('Geoffrey', 'Geoffrey Garen', 0)
250 self._assert_fuzz_match('GGaren', 'Geoffrey Garen', 0)
251
252 def integration_test_contributors_greg_bolsinga(self):
253 pass # self._assert_fuzz_match('Greg', 'Greg Bolsinga', 0)
254
255 def integration_test_contributors_holger_freyther(self):
256 self._assert_fuzz_match('Holger', 'Holger Freyther', 0)
257 self._assert_fuzz_match('Holger Hans Peter Freyther', 'Holger Freyther', 11)
258
259 def integration_test_contributors_jon_sullivan(self):
260 # self._assert_fuzz_match('john', 'John Sullivan', 0)
261 self._assert_fuzz_match('sullivan', 'John Sullivan', 0)
262
263 def integration_test_contributors_jon_honeycutt(self):
264 self._assert_fuzz_match('John Honeycutt', 'Jon Honeycutt', 1)
265 # self._assert_fuzz_match('Jon', 'Jon Honeycutt', 0)
266
267 def integration_test_contributors_jon_honeycutt(self):
268 # self._assert_fuzz_match('justin', 'Justin Garcia', 0)
269 self._assert_fuzz_match('justing', 'Justin Garcia', 0)
270
271 def integration_test_contributors_joseph_pecoraro(self):
272 self._assert_fuzz_match('Joe Pecoraro', 'Joseph Pecoraro', 3)
273
274 def integration_test_contributors_ken_kocienda(self):
275 self._assert_fuzz_match('ken', 'Ken Kocienda', 0)
276 self._assert_fuzz_match('kocienda', 'Ken Kocienda', 0)
277
278 def integration_test_contributors_kenneth_russell(self):
279 self._assert_fuzz_match('Ken Russell', 'Kenneth Russell', 4)
280
281 def integration_test_contributors_kevin_decker(self):
282 self._assert_fuzz_match('kdecker', 'Kevin Decker', 0)
283
284 def integration_test_contributors_kevin_mccullough(self):
285 self._assert_fuzz_match('Kevin M', 'Kevin McCullough', 0)
286 self._assert_fuzz_match('Kevin McCulough', 'Kevin McCullough', 1)
287 self._assert_fuzz_match('mccullough', 'Kevin McCullough', 0)
288
289 def integration_test_contributors_lars_knoll(self):
290 self._assert_fuzz_match('lars', 'Lars Knoll', 0)
291
292 def integration_test_contributors_lars_weintraub(self):
293 self._assert_fuzz_match('levi', 'Levi Weintraub', 0)
294
295 def integration_test_contributors_maciej_stachowiak(self):
296 self._assert_fuzz_match('Maciej', 'Maciej Stachowiak', 0)
297 # self._assert_fuzz_match('mjs', 'Maciej Stachowiak', 0)
298 self._assert_fuzz_match('Maciej S', 'Maciej Stachowiak', 0)
299
300 def integration_test_contributors_mark_rowe(self):
301 # self._assert_fuzz_match('Mark', 'Mark Rowe', 0)
302 self._assert_fuzz_match('bdash', 'Mark Rowe', 0)
303 self._assert_fuzz_match('mrowe', 'Mark Rowe', 0)
304 # self._assert_fuzz_match('Brian Dash', 'Mark Rowe', 0)
305
306 def integration_test_contributors_nikolas_zimmermann(self):
307 # self._assert_fuzz_match('Niko', 'Nikolas Zimmermann', 1)
308 self._assert_fuzz_match('Niko Zimmermann', 'Nikolas Zimmermann', 3)
309 self._assert_fuzz_match('Nikolas', 'Nikolas Zimmermann', 0)
310
311 def integration_test_contributors_oliver_hunt(self):
312 # self._assert_fuzz_match('Oliver', 'Oliver Hunt', 0)
313 self._assert_fuzz_match('Ollie', 'Oliver Hunt', 1)
314 self._assert_fuzz_match('Olliej', 'Oliver Hunt', 0)
315 self._assert_fuzz_match('Olliej Hunt', 'Oliver Hunt', 3)
316 self._assert_fuzz_match('olliej', 'Oliver Hunt', 0)
317 self._assert_fuzz_match('ollie', 'Oliver Hunt', 1)
318 self._assert_fuzz_match('ollliej', 'Oliver Hunt', 1)
319
320 def integration_test_contributors_oliver_hunt(self):
321 self._assert_fuzz_match('Richard', 'Richard Williamson', 0)
322 self._assert_fuzz_match('rjw', 'Richard Williamson', 0)
323
324 def integration_test_contributors_oliver_hunt(self):
325 self._assert_fuzz_match('Rob', 'Rob Buis', 0)
326 self._assert_fuzz_match('rwlbuis', 'Rob Buis', 0)
327
328 def integration_test_contributors_rniwa(self):
329 self._assert_fuzz_match('rniwa@webkit.org', 'Ryosuke Niwa', 0)
330
331 def disabled_integration_test_contributors_simon_fraser(self):
332 pass # self._assert_fuzz_match('Simon', 'Simon Fraser', 0)
333
334 def integration_test_contributors_steve_falkenburg(self):
335 self._assert_fuzz_match('Sfalken', 'Steve Falkenburg', 0)
336 # self._assert_fuzz_match('Steve', 'Steve Falkenburg', 0)
337
338 def integration_test_contributors_sam_weinig(self):
339 self._assert_fuzz_match('Sam', 'Sam Weinig', 0)
340 # self._assert_fuzz_match('Weinig Sam', 'weinig', 0)
341 self._assert_fuzz_match('Weinig', 'Sam Weinig', 0)
342 self._assert_fuzz_match('Sam W', 'Sam Weinig', 0)
343 self._assert_fuzz_match('Sammy Weinig', 'Sam Weinig', 2)
344
345 def integration_test_contributors_tim_omernick(self):
346 # self._assert_fuzz_match('timo', 'Tim Omernick', 0)
347 self._assert_fuzz_match('TimO', 'Tim Omernick', 0)
348 # self._assert_fuzz_match('Timo O', 'Tim Omernick', 0)
349 # self._assert_fuzz_match('Tim O.', 'Tim Omernick', 0)
350 self._assert_fuzz_match('Tim O', 'Tim Omernick', 0)
351
352 def integration_test_contributors_timothy_hatcher(self):
353 # self._assert_fuzz_match('Tim', 'Timothy Hatcher', 0)
354 # self._assert_fuzz_match('Tim H', 'Timothy Hatcher', 0)
355 self._assert_fuzz_match('Tim Hatcher', 'Timothy Hatcher', 4)
356 self._assert_fuzz_match('Tim Hatcheri', 'Timothy Hatcher', 5)
357 self._assert_fuzz_match('timothy', 'Timothy Hatcher', 0)
358 self._assert_fuzz_match('thatcher', 'Timothy Hatcher', 1)
359 self._assert_fuzz_match('xenon', 'Timothy Hatcher', 0)
360 self._assert_fuzz_match('Hatcher', 'Timothy Hatcher', 0)
361 # self._assert_fuzz_match('TimH', 'Timothy Hatcher', 0)
362
363 def integration_test_contributors_tor_arne_vestbo(self):
364 self._assert_fuzz_match('Tor Arne', u"Tor Arne Vestb\u00f8", 1) # Match es IRC nickname
365
366 def integration_test_contributors_vicki_murley(self):
367 self._assert_fuzz_match('Vicki', u"Vicki Murley", 0)
368
369 def integration_test_contributors_zack_rusin(self):
370 self._assert_fuzz_match('Zack', 'Zack Rusin', 0)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/common/config/committers.py ('k') | Tools/Scripts/webkitpy/common/config/committervalidator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698