Example #1
0
def test_get_user_email():
    api = main.EchoApi()

    with mock.patch('main.endpoints.get_current_user') as user_mock:
        user_mock.return_value = None
        with pytest.raises(endpoints.UnauthorizedException):
            api.get_user_email(message_types.VoidMessage())

        user_mock.return_value = mock.Mock()
        user_mock.return_value.email.return_value = '*****@*****.**'
        response = api.get_user_email(message_types.VoidMessage())
        assert '*****@*****.**' == response.message
Example #2
0
def test_echo():
    api = main.EchoApi()
    request = main.EchoApi.echo.remote.request_type(message='Hello world!')
    response = api.echo(request)
    assert 'Hello world!' == response.message
Example #3
0
def test_bicycle():
    api = main.EchoApi()
    request = main.EchoApi.echo.remote.request_type(content='Hello Merlin!')
    response = api.echo(request)
    assert 'Hello Merlin!' == response.content
def test_echo():
    api = main.EchoApi()
    request = main.EchoApi.echo.remote.request_type(message='Hello world!')
    response = api.echo(request)
    if 'Hello world!' != response.message:
        raise AssertionError
Example #5
0
def test_echo():
    api = main.EchoApi()
    response = api.echo(main.Echo(content='Hello world!'))
    assert 'Hello world!' == response.content