def test_active_finished_mix(self): httpretty.register_uri( httpretty.GET, self.url_endpoint, body="""[{"id": 1, "state": "created"}, {"id": 2, "state": "finished"}]""", ) builds = get_builds('foo', 'bar-repo') self.assertEqual(1, len(builds))
def test_all_finished(self): httpretty.register_uri( httpretty.GET, self.url_endpoint, body="""[{"id": 1, "state": "finished"}, {"id": 2, "state": "finished"}]""", ) builds = get_builds('foo', 'bar-repo', is_finished=True) self.assertEqual(2, len(builds))
def test_good_build_response(self): httpretty.register_uri( httpretty.GET, self.url_endpoint, body="""[{"id": 1, "state": "created"}, {"id": 2, "state": "started"}]""", ) builds = get_builds('foo', 'bar-repo') self.assertEqual(2, len(builds))
def test_only_queued_builds(self): httpretty.register_uri( httpretty.GET, self.url_endpoint, body="""[{"id": 1, "state": "created"}, {"id": 2, "state": "created"}]""", ) builds = get_builds('foo', 'bar-repo') total_count, started_count = repo_active_build_count(builds) self.assertEqual(2, total_count) self.assertEqual(0, started_count)