Changeset 57948 in webkit
- Timestamp:
- Apr 20, 2010 8:54:47 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r57947 r57948 1 2010-04-20 Daniel Bates <dbates@rim.com> 2 3 Reviewed by Eric Seidel. 4 5 https://bugs.webkit.org/show_bug.cgi?id=37748 6 7 Make Sheriffbot more inspirational. 8 9 * Scripts/webkitpy/common/net/bugzilla.py: 10 * Scripts/webkitpy/common/net/bugzilla_unittest.py: 11 * Scripts/webkitpy/tool/bot/irc_command.py: 12 * Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py: 13 * Scripts/webkitpy/tool/mocktool.py: 14 1 15 2010-04-20 Kent Tamura <tkent@chromium.org> 2 16 -
trunk/WebKitTools/Scripts/webkitpy/common/net/bugzilla.py
r57920 r57948 231 231 return self._parse_attachment_ids_request_query(self._load_query(query)) 232 232 233 def _parse_quips(self, page): 234 soup = BeautifulSoup(page, convertEntities=BeautifulSoup.HTML_ENTITIES) 235 quips = soup.find(text=re.compile(r"Existing quips:")).findNext("ul").findAll("li") 236 return [unicode(quip_entry.string) for quip_entry in quips] 237 238 def fetch_quips(self): 239 return self._parse_quips(self._load_query("/quips.cgi?action=show")) 240 233 241 # List of all r+'d bugs. 234 242 def fetch_bug_ids_from_pending_commit_list(self): … … 365 373 self.queries = BugzillaQueries(self) 366 374 self.committers = committers 375 self.cached_quips = [] 367 376 368 377 # FIXME: We should use some sort of Browser mock object when in dryrun … … 377 386 bug_server_regex = "https?://%s/" % re.sub('\.', '\\.', bug_server_host) 378 387 bug_server_url = "https://%s/" % bug_server_host 388 389 def quips(self): 390 # We only fetch and parse the list of quips once per instantiation 391 # so that we do not burden bugs.webkit.org. 392 if not self.cached_quips and not self.dryrun: 393 self.cached_quips = self.queries.fetch_quips() 394 return self.cached_quips 379 395 380 396 def bug_url_for_bug_id(self, bug_id, xml=False): -
trunk/WebKitTools/Scripts/webkitpy/common/net/bugzilla_unittest.py
r57869 r57948 308 308 </html> 309 309 """ 310 _sample_quip_page = u""" 311 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 312 "http://www.w3.org/TR/html4/loose.dtd"> 313 <html> 314 <head> 315 <title>Bugzilla Quip System</title> 316 </head> 317 <body> 318 <h2> 319 320 Existing quips: 321 </h2> 322 <ul> 323 <li>Everything should be made as simple as possible, but not simpler. - Albert Einstein</li> 324 <li>Good artists copy. Great artists steal. - Pablo Picasso</li> 325 <li>\u00e7gua mole em pedra dura, tanto bate at\u008e que fura.</li> 326 327 </ul> 328 </body> 329 </html> 330 """ 310 331 311 332 def test_request_page_parsing(self): … … 313 334 self.assertEquals([40511, 40722, 40723], queries._parse_attachment_ids_request_query(self._sample_request_page)) 314 335 336 def test_quip_page_parsing(self): 337 queries = BugzillaQueries(None) 338 expected_quips = ["Everything should be made as simple as possible, but not simpler. - Albert Einstein", "Good artists copy. Great artists steal. - Pablo Picasso", u"\u00e7gua mole em pedra dura, tanto bate at\u008e que fura."] 339 self.assertEquals(expected_quips, queries._parse_quips(self._sample_quip_page)) 340 315 341 def test_load_query(self): 316 342 queries = BugzillaQueries(Mock()) -
trunk/WebKitTools/Scripts/webkitpy/tool/bot/irc_command.py
r57869 r57948 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 import random 29 30 import webkitpy.common.config.irc as config_irc 30 31 … … 77 78 class Hi(IRCCommand): 78 79 def execute(self, nick, args, tool, sheriff): 79 return '"Only you can prevent forest fires." -- Smokey the Bear' 80 quips = tool.bugs.quips() 81 quips.append('"Only you can prevent forest fires." -- Smokey the Bear') 82 return random.choice(quips) -
trunk/WebKitTools/Scripts/webkitpy/tool/bot/sheriffircbot_unittest.py
r57869 r57948 28 28 29 29 import unittest 30 import random 30 31 31 32 from webkitpy.common.system.outputcapture import OutputCapture … … 46 47 class SheriffIRCBotTest(unittest.TestCase): 47 48 def test_hi(self): 49 random.seed(23324) 48 50 expected_stderr = 'MOCK: irc.post: "Only you can prevent forest fires." -- Smokey the Bear\n' 49 51 OutputCapture().assert_outputs(self, run, args=["hi"], expected_stderr=expected_stderr) -
trunk/WebKitTools/Scripts/webkitpy/tool/mocktool.py
r57920 r57948 271 271 log("bug_description: %s" % bug_description) 272 272 273 def quips(self): 274 return ["Good artists copy. Great artists steal. - Pablo Picasso"] 275 273 276 def fetch_bug(self, bug_id): 274 277 return Bug(self.bug_cache.get(bug_id), self)
Note: See TracChangeset
for help on using the changeset viewer.