Esempio n. 1
0
def test_request_missing_headers():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.headers == []
Esempio n. 2
0
def test_request_missing_query():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.query == ''
Esempio n. 3
0
def test_request_headers():
    headers = {'Content-Type': 'application/json'}
    interaction = {'request': {'headers': headers}}
    request = build_request_from_interaction(interaction)

    assert request.headers == [('Content-Type', 'application/json')]
Esempio n. 4
0
def test_request_missing_path():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.path == ''
Esempio n. 5
0
def test_request_query():
    interaction = {'request': {'query': '?spam=eggs'}}
    request = build_request_from_interaction(interaction)

    assert request.query == '?spam=eggs'
Esempio n. 6
0
def test_request_path():
    interaction = {'request': {'path': '/spam'}}
    request = build_request_from_interaction(interaction)

    assert request.path == '/spam'
Esempio n. 7
0
def test_request_missing_method():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.method == 'GET'
Esempio n. 8
0
def test_request_method():
    interaction = {'request': {'method': 'POST'}}
    request = build_request_from_interaction(interaction)

    assert request.method == 'POST'
Esempio n. 9
0
def test_request_missing_body():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.body is None
Esempio n. 10
0
def test_request_body():
    body = {'spam': 'eggs'}
    interaction = {'request': {'body': body}}
    request = build_request_from_interaction(interaction)

    assert request.body == body