Beispiel #1
0
    def test_fail_load_authorisation_class(self):
        config = BrainSecuritiesConfiguration()
        config._authorisation = BrainSecurityAuthorisationConfiguration()
        config._authentication = BrainSecurityAuthenticationConfiguration()
        config._account_linker = BrainSecurityAccountLinkerConfiguration()

        mgr = MockSecurityManager(config, fail_authorise=True)
        self.assertIsNotNone(mgr)

        client = TestClient()
        mgr.load_security_services(client)

        self.assertIsNone(mgr.authorisation)
        self.assertIsNotNone(mgr.authentication)
        self.assertIsNotNone(mgr.account_linker)
Beispiel #2
0
    def test_fail_load_account_linking_class_missing(self):
        config = BrainSecuritiesConfiguration()
        config._authorisation = BrainSecurityAuthorisationConfiguration()
        config._authentication = BrainSecurityAuthenticationConfiguration()
        config._account_linker = BrainSecurityAccountLinkerConfiguration()
        config._account_linker._classname = None

        mgr = SecurityManager(config)
        self.assertIsNotNone(mgr)

        client = TestClient()
        mgr.load_security_services(client)

        self.assertIsNotNone(mgr.authorisation)
        self.assertIsNotNone(mgr.authentication)
        self.assertIsNone(mgr.account_linker)