Exemple #1
0
    def test_parseExtensionArgsWithAuthLevels_openID1(self):
        request_args = {
            'preferred_auth_level_types':'nist jisa',
            }
        expected_auth_levels = [pape.LEVELS_NIST, pape.LEVELS_JISA]
        self.req.parseExtensionArgs(request_args, is_openid1=True)
        self.assertEqual(expected_auth_levels,
                         self.req.preferred_auth_level_types)

        self.req = pape.Request()
        self.req.parseExtensionArgs(request_args, is_openid1=False)
        self.assertEqual([],
                         self.req.preferred_auth_level_types)

        self.req = pape.Request()
        self.assertRaises(ValueError,
                              self.req.parseExtensionArgs,
                              request_args, is_openid1=False, strict=True)
    def test_construct(self):
        self.assertEqual(self.req.preferred_auth_policies, [])
        self.assertIsNone(self.req.max_auth_age)
        self.assertEqual(self.req.ns_alias, 'pape')
        self.assertFalse(self.req.preferred_auth_level_types)

        bogus_levels = ['http://janrain.com/our_levels']
        req2 = pape.Request([pape.AUTH_MULTI_FACTOR], 1000, bogus_levels)
        self.assertEqual(req2.preferred_auth_policies,
                         [pape.AUTH_MULTI_FACTOR])
        self.assertEqual(req2.max_auth_age, 1000)
        self.assertEqual(req2.preferred_auth_level_types, bogus_levels)
    def test_construct(self):
        self.failUnlessEqual([], self.req.preferred_auth_policies)
        self.failUnlessEqual(None, self.req.max_auth_age)
        self.failUnlessEqual('pape', self.req.ns_alias)
        self.failIf(self.req.preferred_auth_level_types)

        bogus_levels = ['http://janrain.com/our_levels']
        req2 = pape.Request([pape.AUTH_MULTI_FACTOR], 1000, bogus_levels)
        self.failUnlessEqual([pape.AUTH_MULTI_FACTOR],
                             req2.preferred_auth_policies)
        self.failUnlessEqual(1000, req2.max_auth_age)
        self.failUnlessEqual(bogus_levels, req2.preferred_auth_level_types)
Exemple #4
0
 def setUp(self):
     self.req = pape.Request()