Exemple #1
0
def test_get_user_info(mocker, user_info):
    # GIVEN not query parameters or payload
    # WHEN I access to the url GET /users/daniel.barragan
    # THEN the information for an user must be returned
    mocker.patch.object(handlers, 'get_user_info', return_value=user_info)
    user_info = handlers.get_user_info('d4n13lbc')
    assert {'user_info': 'some_info'} == user_info
Exemple #2
0
def test_get_user_info(mocker, user_info):
    # GIVEN not query parameters or payload
    # WHEN I access to the url GET /users/john.doe
    # THEN the information for the user must be returned
    mocker.patch.object(handlers, 'get_user_info', return_value=user_info)
    user_info = handlers.get_user_info('john.doe')
    assert {'username': '******', id': '123', 'role': 'admin'} == user_info
def test_get_user_info():
    # GIVEN not query parameters or payload
    # WHEN I access to the url GET /users/john.doe
    # THEN the information for the user must be returned
    user_info = handlers.get_user_info('john.doe')
    assert user_info['username'] == 'john.doe'
    assert user_info['id'] == '123'
    assert user_info['role'] == 'admin'
    assert len(user_info) == 3
def test_get_user_info_with_patch(mocker, user_role):
    # GIVEN not query parameters or payload
    # WHEN I access to the url GET /users/john.doe
    # THEN the information for the user must be returned
    mocker.patch.object(handlers, 'query_role', return_value=user_role)
    user_info = handlers.get_user_info('john.doe')
    assert user_info['username'] == 'john.doe'
    assert user_info['id'] == '123'
    assert user_info['role'] == 'collaborator'
    assert len(user_info) == 3