Пример #1
0
 def test_successful_fed_login(self):
     user = RpcUser()
     user.fed_id = self.config.get('Test Visitor', 'fed_id')
     user.name = self.config.get('Test Visitor', 'user_name')
     user.auth_system = RpcService()
     user.auth_system.site_name = self.config.get('My Test Vista', 'site_name')
     user.auth_system.site_id = self.config.get('My Test Vista', 'site_id')
     user.uid = self.config.get('Test Visitor', 'uid')
     self.cxn.connect()
     self.assertTrue(self.cxn.is_connected)
     uid, greeting = user.fed_login(self.cxn)
     self.cxn.disconnect()
     self.assertEqual('33', uid)
     self.assertEqual('OK', greeting)
Пример #2
0
    def testHasFederatedCredentials(self):
        user = RpcUser()
        self.assertFalse(user.has_federated_credentials())

        user.auth_system = RpcService()
        user.auth_system.site_id = 1
        self.assertFalse(user.has_federated_credentials())

        user.auth_system.site_name = 'the_site_name'
        self.assertFalse(user.has_federated_credentials())

        user.fed_id = '123456789'
        self.assertFalse(user.has_federated_credentials())

        user.name = 'SomeName'
        self.assertFalse(user.has_federated_credentials())

        user.uid = '31'
        self.assertTrue(user.has_federated_credentials())
Пример #3
0
    def test_failed_fed_login(self):
        user = RpcUser()
        user.fed_id = ''
        user.user_name = ''
        user.auth_system = RpcService()
        user.auth_system.site_name = ''
        user.auth_system.site_id = ''
        user.uid = ''
        user.phone =  ''

        self.cxn.connect()
        self.assertTrue(self.cxn.is_connected)
        uid, greeting = None, None
        try:
            uid, greeting = user.fed_login(self.cxn)
            self.fail("Visit should not succeed")
        except RpcError as e:
            self.assertEqual('Invalid federated user credentials', str(e))
            self.assertIsNone(uid)
            self.assertIsNone(greeting)
        finally:
            self.cxn.disconnect()
Пример #4
0
 def testSetFedId(self):
     user = RpcUser()
     user.fed_id = '123456789'
     self.assertEqual('A0E7B1D461C45908CEB1042BFE53B7FDB1E8E486DF00725E14530101650A595C', user._federated_id)
     self.assertEqual('123456789', user.fed_id)