本文整理汇总了Python中pdoauth.models.User.User.getByEmail方法的典型用法代码示例。如果您正苦于以下问题:Python User.getByEmail方法的具体用法?Python User.getByEmail怎么用?Python User.getByEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdoauth.models.User.User
的用法示例。
在下文中一共展示了User.getByEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: your_user_is_deleted_in_deregistration
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def your_user_is_deleted_in_deregistration(self):
with app.test_client() as c:
self.login(c)
user = User.getByEmail(self.usercreation_email)
self.assertTrue(user is not None)
data = dict(
csrf_token = self.getCSRF(c),
credentialType= "password",
identifier= self.usercreation_userid,
secret = self.usercreation_password
)
c.post(config.base_url+'/deregister', data=data)
user = User.getByEmail(self.usercreation_email)
self.assertTrue(user is None)
示例2: ssl_login_registers_and_logs_in_if_you_have_cert_and_give_email
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def ssl_login_registers_and_logs_in_if_you_have_cert_and_give_email(self):
self._keygenAndLogin()
self._logoutAfterKeygen()
user = User.getByEmail(self.usercreation_email)
self.deleteUser(user)
sslLoginBaseUrl = app.config.get("SSL_LOGIN_BASE_URL")
self.driver.get(sslLoginBaseUrl + '/[email protected]')
self.driver.get(sslLoginBaseUrl + '/v1/users/me')
body = self.driver.find_element_by_css_selector("BODY").text
self.assertTrue('{"credentialType": "certificate", "identifier": "' in
body)
self.assertTrue('"email": "[email protected]"' in body)
user = User.getByEmail("[email protected]")
self.deleteUser(user)
self.deleteCerts()
示例3: your_credentials_are_deleted_in_deregistration
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def your_credentials_are_deleted_in_deregistration(self):
with app.test_client() as c:
self.login(c)
user = User.getByEmail(self.usercreation_email)
creds = Credential.getByUser(user)
self.assertTrue(len(creds) > 0)
data = dict(
csrf_token = self.getCSRF(c),
credentialType= "password",
identifier= self.usercreation_userid,
secret = self.usercreation_password
)
c.post(config.base_url+'/deregister', data=data)
user = User.getByEmail(self.usercreation_email)
creds = Credential.getByUser(user)
self.assertTrue(len(creds) == 0)
示例4: if_you_register_without_hash_it_will_be_null
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def if_you_register_without_hash_it_will_be_null(self):
with app.test_client() as c:
data = self.prepareData()
data.pop('digest')
c.post(config.base_url + '/v1/register', data=data)
user = User.getByEmail(self.registered_email)
self.assertEqual(user.hash, None)
示例5: users_without_assurer_assurance_cannot_get_user_by_email
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def users_without_assurer_assurance_cannot_get_user_by_email(self):
user = self.createUserWithCredentials()
self.assertTrue(user is not None)
target = User.getByEmail(self.usercreation_email)
with self.assertRaises(ReportedError) as e:
self.controller.do_get_by_email(target.email)
self.assertTrue(e.exception.status,403)
示例6: users_without_login_cannot_get_user_by_email
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def users_without_login_cannot_get_user_by_email(self):
self.controller._testdata.current_user = None
self.createUserWithCredentials()
target = User.getByEmail(self.usercreation_email)
with self.assertRaises(ReportedError) as e:
self.controller.do_get_by_email(target.email)
self.assertEquals(e.exception.status,403)
示例7: test_users_with_assurer_assurance_can_get_user_by_email
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def test_users_with_assurer_assurance_can_get_user_by_email(self):
self._createAssurer()
self.setupRandom()
self.createUserWithCredentials()
target = User.getByEmail(self.userCreationEmail)
resp = self.controller.doGetByEmail(target.email)
self.assertUserResponse(resp)
示例8: unregistered_user_can_register_with_facebook_in_the_middle_of_login_procedure_of_a_served_application
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def unregistered_user_can_register_with_facebook_in_the_middle_of_login_procedure_of_a_served_application(self):
if config.skipFacebookTests:
return
driver = self.driver
self._gotoOauthPage(driver)
self.switchToTab('registration')
driver.find_element_by_id("Facebook_registration_button").click()
time.sleep(1)
self.master = driver.current_window_handle
timeCount = 1;
while (len(driver.window_handles) == 1 ):
time
timeCount += 1
if ( timeCount > 50 ):
break;
for handle in driver.window_handles:
if handle!=self.master:
driver.switch_to.window(handle)
driver.find_element_by_id("pass").clear()
driver.find_element_by_id("pass").send_keys(config.fbpassword2)
driver.find_element_by_id("email").clear()
driver.find_element_by_id("email").send_keys(config.fbuser2)
driver.find_element_by_id("u_0_2").click()
driver.switch_to.window(self.master)
time.sleep(5)
self.assertTrue(driver.current_url.startswith(self.redirect_uri.lower()))
self.user = User.getByEmail(config.fbuser2)
Credential.getByUser(self.user, "facebook").rm()
self.user.rm()
示例9: test_User_email_with_plus_sign_is_stored_correctly
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def test_User_email_with_plus_sign_is_stored_correctly(self):
email = "test+{0}@example.com".format(self.randString)
user = User.new(email, None)
user2 = User.getByEmail(email)
self.assertEqual(user2.email, email)
self.assertTrue("+" in user2.email)
user.rm()
示例10: getUserForEmailAndOrHash
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def getUserForEmailAndOrHash(self, digest: Digest, email: Union[str,None]):
if email:
user = User.getByEmail(email)
self.checkUserAgainsDigest(digest, user)
return user
users = User.getByDigest(digest)
self.assureExactlyOneUserInList(users)
return users[0]
示例11: test_no_by_email_with_wrong_email
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def test_no_by_email_with_wrong_email(self):
self._createAssurer()
self.setupRandom()
self.createUserWithCredentials()
target = User.getByEmail(self.userCreationEmail)
with self.assertRaises(ReportedError) as context:
self.controller.doGetByEmail('u'+target.email)
self.assertEqual(context.exception.status,404)
示例12: test_password_reset_creates_password_if_it_does_not_exists
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def test_password_reset_creates_password_if_it_does_not_exists(self):
form = self.createPasswordResetFormWithSecret()
user = User.getByEmail(self.userCreationEmail)
passcred = Credential.getByUser(user, "password")
passcred.rm()
self.controller.doPasswordReset(form)
newPassCred = Credential.getByUser(user, "password")
self.assertEqual(newPassCred.secret, CredentialManager.protect_secret(self.newPassword))
示例13: _do_get_by_email
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def _do_get_by_email(self, email):
assurances = Assurance.getByUser(self.getCurrentUser())
if assurances.has_key('assurer'):
user = User.getByEmail(email)
if user is None:
raise ReportedError(["no such user"], status=404)
return self.as_dict(user)
raise ReportedError(["no authorization"], status=403)
示例14: users_without_assurer_assurance_cannot_get_email_and_digest_for_anyone
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def users_without_assurer_assurance_cannot_get_email_and_digest_for_anyone(self):
current_user = self.controller.getCurrentUser()
targetuser=self.createUserWithCredentials()
Assurance.new(targetuser,'test',current_user)
target = User.getByEmail(self.usercreation_email)
with self.assertRaises(ReportedError) as e:
self.showUserByCurrentUser(target.userid)
self.assertTrue(e.exception.status,403)
示例15: test_the_users_hash_is_changed_to_the_new_one
# 需要导入模块: from pdoauth.models.User import User [as 别名]
# 或者: from pdoauth.models.User.User import getByEmail [as 别名]
def test_the_users_hash_is_changed_to_the_new_one(self):
with app.test_client() as client:
resp = self.login(client)
self.assertUserResponse(resp)
user = User.getByEmail(self.userCreationEmail)
self.assertEqual(user.hash, None)
digest = self.createHash()
csrf = self.getCSRF(client)
data = dict(
digest= digest,
csrf_token= csrf
)
resp = client.post(config.BASE_URL+'/v1/users/me/update_hash', data=data)
self.assertEqual(200,resp.status_code)
userAfter = User.getByEmail(self.userCreationEmail)
self.assertEqual(userAfter.hash, digest)