Esempio n. 1
0
def test_get_state_machines_error_response(routemaster_api: RoutemasterAPI):
    httpretty.register_uri(
        httpretty.GET,
        'http://localhost:2017/state-machines',
        content_type='application/json',
        status=502,
    )

    with pytest.raises(requests.HTTPError):
        routemaster_api.get_state_machines()
Esempio n. 2
0
def test_get_state_machines(routemaster_api: RoutemasterAPI):
    data = {
        'state-machines': [{
            'name': 'testing-machine',
            'labels': '/state-machines/testing-machine/labels',
        }]
    }

    httpretty.register_uri(
        httpretty.GET,
        'http://localhost:2017/state-machines',
        body=json.dumps(data),
        content_type='application/json',
    )

    response_json = routemaster_api.get_state_machines()

    assert response_json == [StateMachine('testing-machine')]