def test_fetch_reise_when_cant_download(self, requests, *args):
     result = MagicMock()
     result.status_code = 404
     result.text = "{}"
     requests.get.return_value = result
     with self.assertRaises(RemoteServerError):
         service.fetch_json_data(endpoint='http://fake.endpoint')
    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)
Esempio n. 3
0
def show_dashboard():
    url = service.status_endpoint()
    resource = service.fetch_json_data(endpoint=url)
    pipeline_stats = service.pipelines_stats(resource['pipelines'])
    return render_template('dashboard.html', pipeline_stats=pipeline_stats)
Esempio n. 4
0
def show_status(pipename=config['default']['pipename']):
    url = service.status_endpoint()
    resource = service.fetch_json_data(endpoint=url)
    queues = service.make_queues(resource['pipelines'], pipename)
    return render_template('status.html', queues=queues, pipename=pipename)