Exemple #1
0
 def createEmailtestApp(klass):
     name = klass.createRandomUserId()
     app = Application.new(name, name, "https://{0}.com/".format(name))
     klass.allApps.add(app)
     AppMap.new(app, klass.user)
     klass.boundApps.add(app)
     klass.app = app
Exemple #2
0
 def _getDeregistrationSecret(self):
     self._loginAndDeregister()
     user = self.cred.user
     if self.addAppMapToUser == True:
         app = Application.query.first()  # @UndefinedVariable
         AppMap.new(app, user)
     deregistrationCredential = Credential.getByUser(user, 'deregister')
     secret = deregistrationCredential.secret
     return secret
Exemple #3
0
 def _getDeregistrationSecret(self):
     self._loginAndDeregister()
     user = self.cred.user
     if self.addAppMapToUser==True:
         app = Application.query.first()  # @UndefinedVariable
         AppMap.new(app, user)
     deregistrationCredential = Credential.getByUser(user, 'deregister')
     secret = deregistrationCredential.secret
     return secret
Exemple #4
0
 def test_in_hash_collision_if_the_other_user_is_hand_assured_the_user_is_not_deleted(self):
     anotheruser = self.createUserWithCredentials().user
     digest = self.createHash()
     anotheruser.hash = digest
     Assurance.new(anotheruser, "test", anotheruser)
     anotheruser.save()
     user = self.createUserWithCredentials().user
     app = Application.query.first()  # @UndefinedVariable
     AppMap.new(app, user)
     email = self.userCreationEmail
     additionalInfo = dict()
     with self.assertRaises(ReportedError):
         self.controller.checkHashInOtherUsers(user,additionalInfo,digest)
     self.assertEqual(email, User.getByEmail(email).email)
Exemple #5
0
    def createTestAppMaps(self):
        self.boundApps = set()
        self.emailerApps = list()
        for i in range(20):  # @UnusedVariable
            name = self.createRandomUserId()
            newApp = Application.new(name, name,
                                     "https://{0}.com/".format(name))
            if (random.randint(1, 2) == 1):
                newApp.can_email = True
                newApp.save()
                self.emailerApps.append(newApp)
        self.allApps = set(Application.all())

        self.emailerMaps = list()
        for app in self.allApps:
            if (random.randint(1, 2) == 1):
                self.boundApps.add(app)
                m = AppMap.new(app, self.user)
                if app.can_email and (random.randint(1, 2) == 1):
                    m.can_email = True
                    self.emailerMaps.append(m)
                    m.save()
Exemple #6
0
 def test_appMap_can_email_is_false_even_if_the_app_can_email(self):
     appMap = AppMap.new(self.app,self.user)
     self.emailerApps.append(self.app)
     self.assertEqual(False,appMap.can_email)
Exemple #7
0
 def test_appMap_can_email_is_false_by_default(self):
     appMap = AppMap.new(self.app,self.user)
     self.assertEqual(False,appMap.can_email)
Exemple #8
0
 def test_appMap_can_email_is_false_even_if_the_app_can_email(self):
     appMap = AppMap.new(self.app, self.user)
     self.emailerApps.append(self.app)
     self.assertEqual(False, appMap.can_email)
Exemple #9
0
 def test_appMap_can_email_is_false_by_default(self):
     appMap = AppMap.new(self.app, self.user)
     self.assertEqual(False, appMap.can_email)