Ejemplo n.º 1
0
def test_status_invalid_json_raises_service_error(requests_mock):
    rest_client = RestClient('http://testing-es-url')
    requests_mock.get('http://testing-es-url/api/v1/status',
                      status_code=200,
                      text='NOT JSON')
    with pytest.raises(ServiceError):
        rest_client.server_get_status()
Ejemplo n.º 2
0
def test_status_calls_correct_url(requests_mock):
    rest_client = RestClient('http://testing-es-url')
    requests_mock.get('http://testing-es-url/api/v1/status',
                      json={'status': 'ok'})
    rest_client.server_get_status()
    assert requests_mock.called
Ejemplo n.º 3
0
def test_status_500_raises_service_error(requests_mock):
    rest_client = RestClient('http://testing-es-url')
    requests_mock.get('http://testing-es-url/api/v1/status', status_code=500)
    with pytest.raises(ServiceError):
        rest_client.server_get_status()