本文整理汇总了Python中pdoauth.models.User.User类的典型用法代码示例。如果您正苦于以下问题:Python User类的具体用法?Python User怎么用?Python User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_User_email_with_plus_sign_is_stored_correctly
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()
示例2: getUserForEmailAndOrHash
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]
示例3: getUserForEmailAndOrHash
def getUserForEmailAndOrHash(self, digest, email):
if email:
user = User.getByEmail(email)
self.deleteDigestFromOtherUsers(user, digest)
self.checkUserAgainsDigest(digest, user)
return user
users = User.getByDigest(digest)
self.assureExactlyOneUserInList(users)
return users[0]
示例4: getUserForEmailAndOrHash
def getUserForEmailAndOrHash(self, digest: Digest, email: Union[str,None]):
if email:
user = User.getByEmail(email)
if user is None:
raise ReportedError([noSuchUser], 400)
self.checkUserAgainsDigest(digest, user)
return user
users = User.getByDigest(digest)
self.assureExactlyOneUserInList(users)
return users[0]
示例5: your_user_is_deleted_in_deregistration
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)
示例6: ssl_login_registers_and_logs_in_if_you_have_cert_and_give_email
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()
示例7: test_users_with_assurer_assurance_can_get_user_by_email
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: deleteDigestFromOtherUsers
def deleteDigestFromOtherUsers(self, user, digest):
if digest:
users = User.getByDigest(digest)
for anotherUser in users:
if anotherUser.email != user.email:
anotherUser.hash = None
anotherUser.save()
示例9: if_you_register_without_hash_it_will_be_null
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)
示例10: users_without_login_cannot_get_user_by_email
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)
示例11: unregistered_user_can_register_with_facebook_in_the_middle_of_login_procedure_of_a_served_application
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()
示例12: your_credentials_are_deleted_in_deregistration
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)
示例13: users_without_assurer_assurance_cannot_get_user_by_email
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)
示例14: test_no_by_email_with_wrong_email
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)
示例15: test_password_reset_creates_password_if_it_does_not_exists
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))