本文整理匯總了Python中h.accounts.views.ProfileController.profile方法的典型用法代碼示例。如果您正苦於以下問題:Python ProfileController.profile方法的具體用法?Python ProfileController.profile怎麽用?Python ProfileController.profile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類h.accounts.views.ProfileController
的用法示例。
在下文中一共展示了ProfileController.profile方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_profile_changing_password_with_invalid_data_does_not_update_password
# 需要導入模塊: from h.accounts.views import ProfileController [as 別名]
# 或者: from h.accounts.views.ProfileController import profile [as 別名]
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: test_profile_changing_password_with_valid_data_updates_password
# 需要導入模塊: from h.accounts.views import ProfileController [as 別名]
# 或者: from h.accounts.views.ProfileController import profile [as 別名]
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': 'secrets!'})
controller.profile()
assert user.password == 'secrets!'
示例3: test_profile_changing_email_with_valid_data_updates_email
# 需要導入模塊: from h.accounts.views import ProfileController [as 別名]
# 或者: from h.accounts.views.ProfileController import profile [as 別名]
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': '[email protected]'})
controller.profile()
assert user.email == '[email protected]'
示例4: test_profile_changing_password_with_invalid_data_returns_form
# 需要導入模塊: from h.accounts.views import ProfileController [as 別名]
# 或者: from h.accounts.views.ProfileController import profile [as 別名]
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
示例5: test_profile_changing_password_with_valid_data_redirects
# 需要導入模塊: from h.accounts.views import ProfileController [as 別名]
# 或者: from h.accounts.views.ProfileController import profile [as 別名]
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': 'secrets!'})
result = controller.profile()
assert isinstance(result, httpexceptions.HTTPFound)