Esempio n. 1
0
def test_raise_error_if_call_http_result_is_invalid_structure():
    responses.add(responses.GET,
                  'http://10.0.0.1/api/foo/bar',
                  status=200,
                  body='{}')
    with pytest.raises(PresenceError) as pe:
        presence.call_http('GET', 'http://10.0.0.1/api/foo/bar')
Esempio n. 2
0
def test_raise_error_if_call_http_result_is_invalid_structure():
    responses.add(responses.GET,
                  'http://10.0.0.1/api/foo/bar',
                  status=200,
                  body='{"external_address": "10.0.0.2"}')
    data = presence.call_http('GET', 'http://10.0.0.1/api/foo/bar')
    assert data == {'external_address': '10.0.0.2'}
Esempio n. 3
0
def test_raise_error_if_call_http_result_is_invalid_structure():
    responses.add(responses.GET, "http://10.0.0.1/api/foo/bar", status=200, body='{"external_address": "10.0.0.2"}')
    data = presence.call_http("GET", "http://10.0.0.1/api/foo/bar")
    assert data == {"external_address": "10.0.0.2"}
Esempio n. 4
0
def test_raise_error_if_call_http_result_is_invalid_structure():
    responses.add(responses.GET, "http://10.0.0.1/api/foo/bar", status=200, body="{}")
    with pytest.raises(PresenceError) as pe:
        presence.call_http("GET", "http://10.0.0.1/api/foo/bar")