def test_get_status_error_response(routemaster_api: RoutemasterAPI): httpretty.register_uri( httpretty.GET, 'http://localhost:2017/', body=json.dumps({ 'status': 'error', 'message': 'Cannot connect to database', }), content_type='application/json', status=503, ) with pytest.raises(requests.HTTPError): routemaster_api.get_status()
def test_get_status(routemaster_api: RoutemasterAPI): expected = {'status': 'ok', 'state-machines': '/state-machines'} httpretty.register_uri( httpretty.GET, 'http://localhost:2017/', body=json.dumps(expected), content_type='application/json', ) response_json = routemaster_api.get_status() assert response_json == expected