예제 #1
0
def test_login_ajax_returns_status_okay_when_validation_succeeds():
    request = DummyRequest(json_body={}, auth_domain='hypothes.is')
    controller = AjaxAuthController(request)
    controller.form = form_validating_to({'user': FakeUser(username='******')})

    result = controller.login()

    assert result['status'] == 'okay'
예제 #2
0
def test_login_ajax_returns_status_failure_on_validation_failure():
    request = DummyRequest(json_body={})
    controller = AjaxAuthController(request)
    controller.form = invalid_form({'password': '******'})

    result = controller.login()

    assert result['status'] == 'failure'
    assert result['errors'] == {'password': '******'}
예제 #3
0
def test_logout_ajax_returns_status_okay():
    request = DummyRequest()

    result = AjaxAuthController(request).logout()

    assert result['status'] == 'okay'