예제 #1
0
파일: views_test.py 프로젝트: jasdeep/h
def test_reset_password_returns_form_when_validation_fails():
    request = DummyRequest(method='POST')
    controller = ResetPasswordController(request)
    controller.form = invalid_form()

    result = controller.reset_password()

    assert result == {'form': 'invalid form'}
예제 #2
0
def test_reset_password_returns_form_when_validation_fails():
    request = DummyRequest(method='POST')
    controller = ResetPasswordController(request)
    controller.form = invalid_form()

    result = controller.reset_password()

    assert result == {'form': 'invalid form'}
예제 #3
0
파일: views_test.py 프로젝트: jasdeep/h
def test_reset_password_redirects_on_success():
    request = DummyRequest(method='POST')
    user = FakeUser(password='******')
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': user,
                                          'password': '******'})

    result = controller.reset_password()

    assert isinstance(result, httpexceptions.HTTPRedirection)
예제 #4
0
파일: views_test.py 프로젝트: jasdeep/h
def test_reset_password_sets_user_password_from_form():
    request = DummyRequest(method='POST')
    elephant = FakeUser(password='******')
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': elephant,
                                          'password': '******'})

    controller.reset_password()

    assert elephant.password == 's3cure!'
예제 #5
0
def test_reset_password_redirects_on_success():
    request = DummyRequest(method='POST')
    user = FakeUser(password='******')
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': user,
                                          'password': '******'})

    result = controller.reset_password()

    assert isinstance(result, httpexceptions.HTTPRedirection)
예제 #6
0
def test_reset_password_sets_user_password_from_form():
    request = DummyRequest(method='POST')
    elephant = FakeUser(password='******')
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': elephant,
                                          'password': '******'})

    controller.reset_password()

    assert elephant.password == 's3cure!'
예제 #7
0
파일: views_test.py 프로젝트: jasdeep/h
def test_reset_password_emits_event(event, notify):
    request = DummyRequest(method='POST')
    user = FakeUser(password='******')
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': user,
                                          'password': '******'})

    controller.reset_password()

    event.assert_called_with(request, user)
    notify.assert_called_with(event.return_value)
예제 #8
0
def test_reset_password_emits_event(event, notify):
    request = DummyRequest(method='POST')
    user = FakeUser(password='******')
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': user,
                                          'password': '******'})

    controller.reset_password()

    event.assert_called_with(request, user)
    notify.assert_called_with(event.return_value)
예제 #9
0
def test_reset_password_deletes_activation():
    request = DummyRequest(method='POST')
    user = FakeUser(password='******')
    user.activation = mock.sentinel.activation
    controller = ResetPasswordController(request)
    controller.form = form_validating_to({'user': user,
                                          'password': '******'})

    controller.reset_password()

    assert mock.sentinel.activation in request.db.deleted