def test_status_parsing(self): buildbot = BuildBot() soup = BeautifulSoup(self._example_one_box_status) status_table = soup.find("table") input_rows = status_table.findAll('tr') for x in range(len(input_rows)): status_row = input_rows[x] expected_parsing = self._expected_example_one_box_parsings[x] builder = buildbot._parse_builder_status_from_row(status_row) # Make sure we aren't parsing more or less than we expect self.assertEquals(builder.keys(), expected_parsing.keys()) for key, expected_value in expected_parsing.items(): self.assertEquals(builder[key], expected_value, ("Builder %d parse failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expected_value)))
def test_status_parsing(self): buildbot = BuildBot() soup = BeautifulSoup(self._example_one_box_status) status_table = soup.find("table") input_rows = status_table.findAll('tr') for x in range(len(input_rows)): status_row = input_rows[x] expected_parsing = self._expected_example_one_box_parsings[x] builder = buildbot._parse_builder_status_from_row(status_row) # Make sure we aren't parsing more or less than we expect self.assertEquals(builder.keys(), expected_parsing.keys()) for key, expected_value in expected_parsing.items(): self.assertEquals(builder[key], expected_value, ( "Builder %d parse failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expected_value)))
def test_core_builder_methods(self): buildbot = BuildBot() # Override builder_statuses function to not touch the network. def example_builder_statuses( ): # We could use instancemethod() to bind 'self' but we don't need to. return BuildBotTest._expected_example_one_box_parsings buildbot.builder_statuses = example_builder_statuses buildbot.core_builder_names_regexps = ['Leopard', "Windows.*Build"] self.assertEquals(buildbot.red_core_builders_names(), []) self.assertTrue(buildbot.core_builders_are_green()) buildbot.core_builder_names_regexps = ['SnowLeopard', 'Qt'] self.assertEquals(buildbot.red_core_builders_names(), [u'SnowLeopard Intel Release', u'Qt Linux Release']) self.assertFalse(buildbot.core_builders_are_green())
def test_builder_name_regexps(self): buildbot = BuildBot() example_builders = [ { 'name': u'Leopard Debug (Build)', }, { 'name': u'Leopard Debug (Tests)', }, { 'name': u'Windows Release (Build)', }, { 'name': u'Windows Debug (Tests)', }, { 'name': u'Qt Linux Release', }, ] name_regexps = ['Leopard', "Windows.*Build"] expected_builders = [ { 'name': u'Leopard Debug (Build)', }, { 'name': u'Leopard Debug (Tests)', }, { 'name': u'Windows Release (Build)', }, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps( example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_builder_name_regexps(self): buildbot = BuildBot() example_builders = [ { 'name': u'Leopard Debug (Build)', }, { 'name': u'Leopard Debug (Tests)', }, { 'name': u'Windows Release (Build)', }, { 'name': u'Windows Debug (Tests)', }, { 'name': u'Qt Linux Release', }, ] name_regexps = [ 'Leopard', "Windows.*Build" ] expected_builders = [ { 'name': u'Leopard Debug (Build)', }, { 'name': u'Leopard Debug (Tests)', }, { 'name': u'Windows Release (Build)', }, ] # This test should probably be updated if the default regexp list changes self.assertEquals(buildbot.core_builder_names_regexps, name_regexps) builders = buildbot._builder_statuses_with_names_matching_regexps(example_builders, name_regexps) self.assertEquals(builders, expected_builders)
def test_core_builder_methods(self): buildbot = BuildBot() # Override builder_statuses function to not touch the network. def example_builder_statuses(): # We could use instancemethod() to bind 'self' but we don't need to. return BuildBotTest._expected_example_one_box_parsings buildbot.builder_statuses = example_builder_statuses buildbot.core_builder_names_regexps = [ 'Leopard', "Windows.*Build" ] self.assertEquals(buildbot.red_core_builders_names(), []) self.assertTrue(buildbot.core_builders_are_green()) buildbot.core_builder_names_regexps = [ 'SnowLeopard', 'Qt' ] self.assertEquals(buildbot.red_core_builders_names(), [ u'SnowLeopard Intel Release', u'Qt Linux Release' ]) self.assertFalse(buildbot.core_builders_are_green())