Exemple #1
0
def test_get_echo():
    request = {
        'time': datetime.now().timestamp(),
        'action': 'now',
        'data': 'Hello'
    }

    response = get_echo(request)

    assert response.get('data') == 'Hello'
Exemple #2
0
def test_get_echo():
    action_name = 'echo'
    data = 'Some data'

    request = {
        'actions': action_name,
        'time': datetime.now().timestamp(),
        'data': data,
    }

    expected = {
        'actions': action_name,
        'user': None,
        'time': None,
        'data': data,
        'code': 200,
    }

    response = get_echo(request)

    assert response.get('data') == expected.get('data')
def test_get_echo(request_fixture, response_fixture):

    response = get_echo(request_fixture)

    assert response_fixture.get('code') == response.get('code')
Exemple #4
0
def test_data_get_echo(expected_request):
    actual_response = get_echo(expected_request)
    assert actual_response.get('data') == 'Echo, bitch'
Exemple #5
0
def test_code_get_echo(expected_request):
    actual_response = get_echo(expected_request)
    assert actual_response.get('code') == 200
Exemple #6
0
def test_action_get_echo(expected_request):
    actual_response = get_echo(expected_request)
    assert actual_response.get('action') == 'echo'
def test_echo_bad_request():
    request = {'time': datetime.now().timestamp(), 'action': 'now'}

    response = get_echo(request)

    assert response.get('code') == 400
def test_get_echo(valid_request, assert_response):
    response = get_echo(valid_request)

    for name, value in response.items():
        if name != 'time':
            assert assert_response.get('name') == response.get('name')
Exemple #9
0
def test_data_get_echo(initial_request, expected_code, expected_data):
    actual_response = get_echo(initial_request)
    assert actual_response.get('data') == expected_data
Exemple #10
0
def test_action_get_echo(initial_request, expected_action, expected_code,
                         expected_data):
    actual_response = get_echo(initial_request)
    assert actual_response.get('action') == expected_action