예제 #1
0
파일: views_test.py 프로젝트: jasdeep/h
def test_profile_changing_password_with_invalid_data_does_not_update_password():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = invalid_form()

    controller.profile()

    assert user.password is None
예제 #2
0
파일: views_test.py 프로젝트: jasdeep/h
def test_profile_changing_email_with_valid_data_updates_email():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'email'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['email'] = form_validating_to({'email': '*****@*****.**'})

    controller.profile()

    assert user.email == '*****@*****.**'
예제 #3
0
파일: views_test.py 프로젝트: jasdeep/h
def test_profile_changing_password_with_valid_data_updates_password():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = form_validating_to({'new_password': '******'})

    controller.profile()

    assert user.password == 'secrets!'
예제 #4
0
def test_profile_changing_password_with_invalid_data_does_not_update_password():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = invalid_form()

    controller.profile()

    assert user.password is None
예제 #5
0
def test_profile_changing_password_with_valid_data_updates_password():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = form_validating_to({'new_password': '******'})

    controller.profile()

    assert user.password == 'secrets!'
예제 #6
0
def test_profile_changing_email_with_valid_data_updates_email():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'email'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['email'] = form_validating_to({'email': '*****@*****.**'})

    controller.profile()

    assert user.email == '*****@*****.**'
예제 #7
0
파일: views_test.py 프로젝트: jasdeep/h
def test_profile_changing_password_with_invalid_data_returns_form():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = invalid_form()

    result = controller.profile()

    assert 'password_form' in result
예제 #8
0
파일: views_test.py 프로젝트: jasdeep/h
def test_profile_changing_password_with_valid_data_redirects():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = form_validating_to({'new_password': '******'})

    result = controller.profile()

    assert isinstance(result, httpexceptions.HTTPFound)
예제 #9
0
def test_profile_changing_password_with_invalid_data_returns_form():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = invalid_form()

    result = controller.profile()

    assert 'password_form' in result
예제 #10
0
def test_profile_changing_password_with_valid_data_redirects():
    user = FakeUser(email=None, password=None)
    request = DummyRequest(post={'__formid__': 'password'},
                           authenticated_user=user)
    controller = ProfileController(request)
    controller.forms['password'] = form_validating_to({'new_password': '******'})

    result = controller.profile()

    assert isinstance(result, httpexceptions.HTTPFound)