def test_request_page_parsing(self): queries = BugzillaQueries(None) self.assertEqual([40511, 40722, 40723], queries._parse_attachment_ids_request_query( self._sample_request_page)) self.assertEqual([40722, 40723], queries._parse_attachment_ids_request_query( self._sample_request_page, datetime.datetime(2009, 10, 4, 11, 38, 44)))
def test_quip_page_parsing(self): queries = BugzillaQueries(None) 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." ] self.assertEqual(expected_quips, queries._parse_quips(self._sample_quip_page))
def test_parse_result_count(self): queries = BugzillaQueries(None) # Pages with results, always list the count at least twice. self._assert_result_count(queries, '<span class="bz_result_count">314 bugs found.</span><span class="bz_result_count">314 bugs found.</span>', 314) self._assert_result_count(queries, '<span class="bz_result_count">Zarro Boogs found.</span>', 0) self._assert_result_count(queries, '<span class="bz_result_count">\n \nOne bug found.</span>', 1) self.assertRaises(Exception, queries._parse_result_count, ['Invalid'])
def test_load_query(self): queries = BugzillaQueries(Mock()) queries._load_query("request.cgi?action=queue&type=review&group=type")