コード例 #1
0
ファイル: UserInfoTest.py プロジェクト: Claymanus/PDOauth
 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'])
コード例 #2
0
 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'])
コード例 #3
0
ファイル: Controller.py プロジェクト: Claymanus/PDOauth
 def computeAssurancesForApp(self, user, app):
     appAssurances = AppAssurance.get(app)
     userAssurances = Assurance.listByUser(user)
     shownAssurances = list()
     for userAssurance in userAssurances:
         if userAssurance.name in appAssurances:
             shownAssurances.append(userAssurance.name)
     return shownAssurances
コード例 #4
0
 def computeAssurancesForApp(self, user, app):
     appAssurances = AppAssurance.get(app)
     userAssurances = Assurance.listByUser(user)
     shownAssurances = list()
     for userAssurance in userAssurances:
         if userAssurance.name in appAssurances:
             shownAssurances.append(userAssurance.name)
     return shownAssurances
コード例 #5
0
def do_main(verbose, name, secret, redirectUri, assurances):
    if verbose and verbose > 0:
        print("registering application {0} with secret {1} at {2}".format(
            name, secret, redirectUri))
    app = Application.new(name, secret, redirectUri)
    for assurance in assurances:
        AppAssurance(app, assurance).save()
    if app is None:
        print("already existing app with this name: {0}".format(name))
        return 2
    print("id of the app is: {0}".format(app.appid))
    return 0
コード例 #6
0
 def test_applicationtool_works_with_a_name_a_https_redrect_uri_a_secret_and_two_assurances(self):
     appname = self.mkRandomString(6)
     password = self.mkRandomPassword()
     uri = "https://%s.org/"%(appname)
     out, err, isExit = self.runApplicationToolWithParameters([appname, password, uri, 'test', 'test2'])
     self.assertFalse(isExit)
     outStr = out.getvalue()
     self.assertTrue( 'id of the app is:' in outStr)
     appId = outStr.split(": ")[1].strip()
     app = Application.find(appname)
     self.assertEqual(app.appid, appId)
     self.assertEqual(app.secret, password)
     self.assertEqual(app.redirect_uri, uri)
     self.assertEqual(AppAssurance.get(app), ['test','test2'])
コード例 #7
0
 def test_applicationtool_works_with_a_name_a_https_redrect_uri_a_secret_and_two_assurances(
         self):
     appname = self.mkRandomString(6)
     password = self.mkRandomPassword()
     uri = "https://%s.org/" % (appname)
     out, err, isExit = self.runApplicationToolWithParameters(
         [appname, password, uri, 'test', 'test2'])
     self.assertFalse(isExit)
     outStr = out.getvalue()
     self.assertTrue('id of the app is:' in outStr)
     appId = outStr.split(": ")[1].strip()
     app = Application.find(appname)
     self.assertEqual(app.appid, appId)
     self.assertEqual(app.secret, password)
     self.assertEqual(app.redirect_uri, uri)
     self.assertEqual(AppAssurance.get(app), ['test', 'test2'])
コード例 #8
0
 def test_if_you_add_the_same_assurance_the_second_time__it_will_have_no_effect(
         self):
     AppAssurance.add(self.app, 'test')
     AppAssurance.add(self.app, 'test')
     assuranceList = AppAssurance.get(self.app)
     self.assertEqual(assuranceList, ['test'])
コード例 #9
0
 def test_assurance_list_for_applications_contain_the_assurances_added(
         self):
     AppAssurance.add(self.app, 'test')
     assuranceList = AppAssurance.get(self.app)
     self.assertEqual(assuranceList, ['test'])
コード例 #10
0
 def test_for_each_application_there_is_a_list_of_assurances_used_by_that_applications(
         self):
     AppAssurance.get(self.app)
コード例 #11
0
ファイル: UserInfoTest.py プロジェクト: Claymanus/PDOauth
 def test_if_you_add_the_same_assurance_the_second_time__it_will_have_no_effect(self):
     AppAssurance.add(self.app, 'test')
     AppAssurance.add(self.app, 'test')
     assuranceList = AppAssurance.get(self.app)
     self.assertEqual(assuranceList, ['test'])
コード例 #12
0
ファイル: UserInfoTest.py プロジェクト: Claymanus/PDOauth
 def test_assurance_list_for_applications_contain_the_assurances_added(self):
     AppAssurance.add(self.app, 'test')
     assuranceList = AppAssurance.get(self.app)
     self.assertEqual(assuranceList, ['test'])
コード例 #13
0
ファイル: UserInfoTest.py プロジェクト: Claymanus/PDOauth
 def test_for_each_application_there_is_a_list_of_assurances_used_by_that_applications(self):
     AppAssurance.get(self.app)