예제 #1
0
def test_request_missing_headers():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.headers == []
예제 #2
0
def test_request_missing_query():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.query == ''
예제 #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')]
예제 #4
0
def test_request_missing_path():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

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

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

    assert request.path == '/spam'
예제 #7
0
def test_request_missing_method():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

    assert request.method == 'GET'
예제 #8
0
def test_request_method():
    interaction = {'request': {'method': 'POST'}}
    request = build_request_from_interaction(interaction)

    assert request.method == 'POST'
예제 #9
0
def test_request_missing_body():
    interaction = {'request': {}}
    request = build_request_from_interaction(interaction)

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

    assert request.body == body