Пример #1
0
    def test_01_resolver(self):
        r = get_resolver_list()
        self.assertTrue("privacyidea.lib.resolvers.PasswdIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.LDAPIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SCIMIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SQLIdResolver" in r, r)

        # check modules
        mlist = get_resolver_module_list()
        mod_name = "privacyidea.lib.resolvers.PasswdIdResolver"
        module = importlib.import_module(mod_name)

        self.assertTrue(module in mlist, mlist)

        # At the beginning the resolver classes are not cached.
        self.assertFalse("pi_resolver_classes" in current_app.config,
                         current_app.config)
        r = get_resolver_classes()
        self.assertTrue(PWResolver in r, r)
        # Now the resolver classes are cached
        self.assertTrue("pi_resolver_classes" in current_app.config,
                        current_app.config)
        r = get_resolver_classes()
        self.assertTrue(PWResolver in r, r)

        # Class dict
        (classes, types) = get_resolver_class_dict()
        self.assertTrue(
            'privacyidea.lib.resolvers.PasswdIdResolver'
            '.IdResolver' in classes, classes)
        self.assertTrue(
            classes.get('privacyidea.lib.resolvers.PasswdIdResolver.IdResolver'
                        ) == PWResolver, classes)
        self.assertTrue(
            'privacyidea.lib.resolvers.PasswdIdResolver'
            '.IdResolver' in types, types)
        self.assertTrue(
            types.get('privacyidea.lib.resolvers.PasswdIdResolver'
                      '.IdResolver') == "passwdresolver", types)

        # At the start the resolvers are not stored in the current_app.config
        self.assertFalse("pi_resolver_types" in current_app.config,
                         current_app.config)
        # When the resolvers are determined, they are stored
        types = get_resolver_types()
        self.assertTrue("passwdresolver" in types, types)
        # Now the resolver types are contained.
        self.assertTrue("pi_resolver_types" in current_app.config,
                        current_app.config)
        types = get_resolver_types()
        self.assertTrue("passwdresolver" in types, types)
Пример #2
0
    def test_01_resolver(self):
        r = get_resolver_list()
        self.assertTrue("privacyidea.lib.resolvers.PasswdIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.LDAPIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SCIMIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SQLIdResolver" in r, r)

        # check modules
        mlist = get_resolver_module_list()
        mod_name = "privacyidea.lib.resolvers.PasswdIdResolver"
        module = importlib.import_module(mod_name)

        self.assertTrue(module in mlist, mlist)

        # At the beginning the resolver classes are not cached.
        self.assertFalse("pi_resolver_classes" in current_app.config,
                                current_app.config)
        r = get_resolver_classes()
        self.assertTrue(PWResolver in r, r)
        # Now the resolver classes are cached
        self.assertTrue("pi_resolver_classes" in current_app.config,
                                current_app.config)
        r = get_resolver_classes()
        self.assertTrue(PWResolver in r, r)

        # Class dict
        (classes, types) = get_resolver_class_dict()
        self.assertTrue('privacyidea.lib.resolvers.PasswdIdResolver'
                        '.IdResolver' in classes, classes)
        self.assertTrue(classes.get(
            'privacyidea.lib.resolvers.PasswdIdResolver.IdResolver') ==
                        PWResolver, classes)
        self.assertTrue('privacyidea.lib.resolvers.PasswdIdResolver'
                        '.IdResolver' in types, types)
        self.assertTrue(types.get('privacyidea.lib.resolvers.PasswdIdResolver'
                        '.IdResolver') == "passwdresolver", types)

        # At the start the resolvers are not stored in the current_app.config
        self.assertFalse("pi_resolver_types" in current_app.config,
                         current_app.config)
        # When the resolvers are determined, they are stored
        types = get_resolver_types()
        self.assertTrue("passwdresolver" in types, types)
        # Now the resolver types are contained.
        self.assertTrue("pi_resolver_types" in current_app.config,
                         current_app.config)
        types = get_resolver_types()
        self.assertTrue("passwdresolver" in types, types)
Пример #3
0
    def test_01_resolver(self):
        r = get_resolver_list()
        self.assertTrue("privacyidea.lib.resolvers.PasswdIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.LDAPIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SCIMIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SQLIdResolver" in r, r)

        # check modules
        mlist = get_resolver_module_list()
        mod_name = "privacyidea.lib.resolvers.PasswdIdResolver"
        module = importlib.import_module(mod_name)

        self.assertTrue(module in mlist, mlist)

        r = get_resolver_classes()
        self.assertTrue(PWResolver in r, r)
        # resolver classes must be available here
        self.assertTrue("pi_resolver_classes" in this.config, this.config)
        self.assertTrue("pi_resolver_types" in this.config, this.config)

        # Class dict
        (classes, types) = get_resolver_class_dict()
        self.assertTrue(
            'privacyidea.lib.resolvers.PasswdIdResolver'
            '.IdResolver' in classes, classes)
        self.assertTrue(
            classes.get('privacyidea.lib.resolvers.PasswdIdResolver.IdResolver'
                        ) == PWResolver, classes)
        self.assertTrue(
            'privacyidea.lib.resolvers.PasswdIdResolver'
            '.IdResolver' in types, types)
        self.assertTrue(
            types.get('privacyidea.lib.resolvers.PasswdIdResolver'
                      '.IdResolver') == "passwdresolver", types)

        # With calling 'get_resolver_classes()' the resolver types will also be cached
        self.assertTrue("pi_resolver_types" in this.config, this.config)
        # When the resolvers are determined, they are stored
        types = get_resolver_types()
        self.assertTrue("passwdresolver" in types, types)
Пример #4
0
    def test_01_resolver(self):
        r = get_resolver_list()
        self.assertTrue("privacyidea.lib.resolvers.PasswdIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.LDAPIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SCIMIdResolver" in r, r)
        self.assertTrue("privacyidea.lib.resolvers.SQLIdResolver" in r, r)

        # check modules
        mlist = get_resolver_module_list()
        mod_name = "privacyidea.lib.resolvers.PasswdIdResolver"
        module = importlib.import_module(mod_name)

        self.assertTrue(module in mlist, mlist)

        r = get_resolver_classes()
        self.assertTrue(PWResolver in r, r)
        # resolver classes must be available here
        self.assertTrue("pi_resolver_classes" in this.config, this.config)
        self.assertTrue("pi_resolver_types" in this.config, this.config)

        # Class dict
        (classes, types) = get_resolver_class_dict()
        self.assertTrue('privacyidea.lib.resolvers.PasswdIdResolver'
                        '.IdResolver' in classes, classes)
        self.assertTrue(classes.get(
            'privacyidea.lib.resolvers.PasswdIdResolver.IdResolver') ==
                        PWResolver, classes)
        self.assertTrue('privacyidea.lib.resolvers.PasswdIdResolver'
                        '.IdResolver' in types, types)
        self.assertTrue(types.get('privacyidea.lib.resolvers.PasswdIdResolver'
                        '.IdResolver') == "passwdresolver", types)

        # With calling 'get_resolver_classes()' the resolver types will also be cached
        self.assertTrue("pi_resolver_types" in this.config, this.config)
        # When the resolvers are determined, they are stored
        types = get_resolver_types()
        self.assertTrue("passwdresolver" in types, types)