当前位置: 首页>>代码示例>>Python>>正文


Python Assurance.new方法代码示例

本文整理汇总了Python中pdoauth.models.Assurance.Assurance.new方法的典型用法代码示例。如果您正苦于以下问题:Python Assurance.new方法的具体用法?Python Assurance.new怎么用?Python Assurance.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdoauth.models.Assurance.Assurance的用法示例。


在下文中一共展示了Assurance.new方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepareHashCollision

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def prepareHashCollision(self, assuredTarget, email=None):
     form = self.prepareLoginForm(email=email)
     self.anotherUser = self.createUserWithCredentials().user
     self.anotherUser.hash = self.targetUser.hash
     if assuredTarget:
         Assurance.new(self.anotherUser, 'test', self.cred.user)
     return form
开发者ID:Claymanus,项目名称:PDOauth,代码行数:9,代码来源:AssuranceTest.py

示例2: _loginAndDeregister

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def _loginAndDeregister(self):
     self.createLoggedInUser()
     user = self.cred.user
     Assurance.new(user, "test", user)
     self._assureHaveCredentialsAndAssurances(user)
     resp = self._doDeregister()
     return resp
开发者ID:Claymanus,项目名称:PDOauth,代码行数:9,代码来源:DeregisterTest.py

示例3: do_verify_email

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def do_verify_email(self, token):
     cred = self.getCredentialForEmailverifyToken(token)
     self.checkEmailverifyCredential(cred)
     user = cred.user
     Assurance.new(user,emailVerification,user)
     cred.rm()
     return self.simple_response("email verified OK")
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:9,代码来源:Controller.py

示例4: setUp

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def setUp(self):
     self.anyuser = User.query.first()  # @UndefinedVariable
     self.user = self.createUserWithCredentials().user
     Assurance.new(self.user, 'emailverification', self.user)
     self.oldEmailAddress = self.userCreationEmail
     self.newEmailAddress = "email{0}@example.com".format(self.mkRandomString(5))
     PDUnitTest.setUp(self)
开发者ID:Claymanus,项目名称:PDOauth,代码行数:9,代码来源:EmailChangeTest.py

示例5: updateHashAndAssurances

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def updateHashAndAssurances(self, user, digest):
     user.hash = digest
     assurances = Assurance.listByUser(user)
     self.deleteHandAssuredAssurances(assurances)
     if digest is not None:
         Assurance.new(user, "hashgiven", user)
     user.save()
开发者ID:Claymanus,项目名称:PDOauth,代码行数:9,代码来源:Controller.py

示例6: users_with_assurer_assurance_can_get_user_by_email

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def users_with_assurer_assurance_can_get_user_by_email(self):
     current_user = self.controller.getCurrentUser()
     Assurance.new(current_user, 'assurer', current_user)
     self.setupRandom()
     self.createUserWithCredentials()
     target = User.getByEmail(self.usercreation_email)
     resp = self.controller.do_get_by_email(target.email)
     self.assertUserResponse(resp)
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:10,代码来源:UserInfotest.py

示例7: test_the_applications_receive_intersection_of_users_assurances_and_applications_assurances

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def test_the_applications_receive_intersection_of_users_assurances_and_applications_assurances(self):
     AppAssurance.add(self.app, 'test')
     AppAssurance.add(self.app, 'test2')
     user = self.cred.user
     Assurance.new(user, "test", user)
     Assurance.new(user, "test3", user)
     userinfo = self.getUserInfo()
     self.assertEqual(userinfo['assurances'], ['test'])
开发者ID:Claymanus,项目名称:PDOauth,代码行数:10,代码来源:UserInfoTest.py

示例8: users_without_assurer_assurance_cannot_get_email_and_digest_for_anyone

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [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)
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:10,代码来源:UserInfotest.py

示例9: no_by_email_with_wrong_email

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def no_by_email_with_wrong_email(self):
     current_user = self.controller.getCurrentUser()
     Assurance.new(current_user, 'assurer', current_user)
     self.setupRandom()
     self.createUserWithCredentials()
     target = User.getByEmail(self.usercreation_email)
     with self.assertRaises(ReportedError) as e:
         self.controller.do_get_by_email('u'+target.email)
     self.assertTrue(e.exception.status,404)
开发者ID:Sinnach0,项目名称:PDOauth,代码行数:11,代码来源:UserInfotest.py

示例10: test_users_with_assurer_assurance_can_get_email_and_digest_for_anyone

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def test_users_with_assurer_assurance_can_get_email_and_digest_for_anyone(self):
     current_user = self._createAssurer()
     targetuser=self.createUserWithCredentials().user
     Assurance.new(targetuser,'test',current_user)
     target = User.getByEmail(self.userCreationEmail)
     resp = self.showUserByCurrentUser(target.userid)
     data = self.fromJson(resp)
     assurances = data['assurances']
     self.assertEqual(assurances['test'][0]['assurer'], current_user.email)
开发者ID:Claymanus,项目名称:PDOauth,代码行数:11,代码来源:UserInfoTest.py

示例11: test_the_emailverification_assurance_does_not_count_in_hash_collision

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def test_the_emailverification_assurance_does_not_count_in_hash_collision(self):
     anotherUser = self.createUserWithCredentials().user
     Assurance.new(anotherUser, "emailverification", anotherUser)
     theHash = self.createHash()
     anotherUser.hash = theHash
     form = self.prepareLoginForm(digest=theHash)
     resp = self.controller.doRegistration(form)
     self.assertEqual(200, resp.status_code)
     data = self.fromJson(resp)
     self.assertEqual(data['message'],anotherUserUsingYourHash)
开发者ID:Claymanus,项目名称:PDOauth,代码行数:12,代码来源:RegistrationTest.py

示例12: test_error_message_on_hash_collision

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
    def test_error_message_on_hash_collision(self):
        anotheruser = self.createUserWithCredentials().user
        digest = self.createHash()
        anotheruser.hash = digest
        Assurance.new(anotheruser, "test", anotheruser)
        anotheruser.save()

        with app.test_client() as client:
            resp = self.doUpdateHashForUser(client, digest=digest)
            self.assertEqual(400, resp.status_code)
            self.assertEqual('{"errors": ["another user is using your hash"]}', resp.data.decode('utf-8'))
开发者ID:Claymanus,项目名称:PDOauth,代码行数:13,代码来源:HashIntegrationTest.py

示例13: doAddAssurance

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def doAddAssurance(self, form):
     neededAssurance = form.assurance.data
     self.assureUserHaveTheGivingAssurancesFor(neededAssurance)
     user = self.getUserForEmailAndOrHash(
             form.digest.data, form.email.data)
     numOfOthers = self.deleteDigestFromOtherUsers(user)
     Assurance.new(user, neededAssurance, self.getCurrentUser())
     msg = [[addedAssurance, neededAssurance, user.email]]
     if numOfOthers:
         msg.append([otherUsersWithYourHash, str(numOfOthers)])
     return self.simple_response(msg)
开发者ID:Claymanus,项目名称:PDOauth,代码行数:13,代码来源:Controller.py

示例14: updateEmailByCredential

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def updateEmailByCredential(self, cred, verify):
     oldemail=cred.user.email
     cred.user.email = cred.getAdditionalInfo()
     cred.user.save()
     for assurance in Assurance.listByUser(cred.user, 'emailverification'):
         assurance.rm()
     if verify:
         Assurance.new(cred.user, 'emailverification', cred.user)
     else:
         self.sendPasswordVerificationEmail(cred.user)
     self.sendEmail(cred.user, None, None, "CHANGE_EMAIL_DONE",oldemail=oldemail, newemail=cred.user.email)
开发者ID:Claymanus,项目名称:PDOauth,代码行数:13,代码来源:EmailHandling.py

示例15: test_if_hash_is_same_no_assurances_deleted

# 需要导入模块: from pdoauth.models.Assurance import Assurance [as 别名]
# 或者: from pdoauth.models.Assurance.Assurance import new [as 别名]
 def test_if_hash_is_same_no_assurances_deleted(self):
     digest = self.createHash()
     user = self.createUserWithCredentials().user
     data = dict(
         digest=digest
         )
     self.controller.checkAndUpdateHash(FakeForm(data), user)
     Assurance.new(user, "test", user)
     self.controller.checkAndUpdateHash(FakeForm(data), user)
     assurances = Assurance.getByUser(user)
     self.assertTrue("test" in assurances.keys())
     self.assertTrue("hashgiven" in assurances.keys())
开发者ID:Claymanus,项目名称:PDOauth,代码行数:14,代码来源:HashTest.py


注:本文中的pdoauth.models.Assurance.Assurance.new方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。