def test_fetch_return_expected_data(self, requests, *args): requests.get = fixtures.status_request( filename='tests/static/status_check.json') result = service.fetch_json_data(endpoint='http://fake.endpoint') expected = fixtures.load_status_data(name='status_check') self.assertDictEqual(result, expected)
def test_pipelines_stats_returns_zeros_for_empty_pipelines(self): resource = fixtures.load_status_data( name='status_pipelines_with_no_buildsets') result = service.pipelines_stats(pipelines=resource['pipelines']) expected = [PipelineStat(name='check', buildsets_count=0), PipelineStat(name='gate', buildsets_count=0)] self.assertEqual(result, expected)
def test_raises_when_no_pipeline(self, *args): resources = fixtures.load_status_data(name='status_no_pipelines') with self.assertRaises(PipelineNotFound): service.make_queues(pipelines=resources['pipelines'], pipename='check')
def test_pipelines_stats_returns_expected_for_queue_with_many_heads(self): resource = fixtures.load_status_data( name='status_pipeline_with_couple_buildsets_in_queue') result = service.pipelines_stats(pipelines=resource['pipelines']) expected = [PipelineStat(name='test_pipeline1', buildsets_count=3)] self.assertEqual(result, expected)
def test_pipelines_stats_returns_empty_when_no_pipelines(self): resource = fixtures.load_status_data(name='status_no_pipelines') expected = [] result = service.pipelines_stats(pipelines=resource['pipelines']) self.assertEqual(result, expected)
def test_pipelines_stats_returns_nothing_for_pipelines_not_in_config(self): resource = fixtures.load_status_data( name='status_pipelines_not_on_list_in_config') result = service.pipelines_stats(pipelines=resource['pipelines']) expected = [PipelineStat(name='check', buildsets_count=0)] self.assertEqual(result, expected)