def test_10_delete_resolver_realm(self): resolvername = "res1" realmname = "r1" # create a resolver r = Resolver(resolvername, "passwdresolver") _rid = r.save() # create a realm with this resolver realm = Realm(realmname) _realm_id = realm.save() rr = ResolverRealm(realm_name=realmname, resolver_name=resolvername) rr_id = rr.save() self.assertTrue(rr_id > 0, rr_id) # check how many resolvers are in the realm db_realm = Realm.query.filter_by(name=realmname).first() self.assertTrue(len(db_realm.resolver_list) == 1, len(db_realm.resolver_list)) # remove the resolver from the realm # we can do this by deleting rr_id rr.delete() # check how many resolvers are in the realm self.assertTrue(len(db_realm.resolver_list) == 0, len(db_realm.resolver_list)) # delete the realm db_realm.delete()
def test_03_create_and_delete_realm(self): realmname = "realm23" r = Realm(realmname) r.save() qr = Realm.query.filter_by(name=realmname).first() self.assertTrue(qr.name == realmname) # delete realm qr.delete() # no realm left q = Realm.query.filter_by(name=realmname).all() self.assertTrue(len(q) == 0)
def create_resolver_realm(self): r = Resolver("resolver1", "passwdresolver") r.save() self.assertTrue(r.name is not None, r.name) self.assertTrue(r.rtype is not None, r.rtype) # Add configuration to the resolver conf = ResolverConfig(r.id, "fileName", "tests/testdata/passwd") conf.save() # Read Resolver r1 = Resolver.query.filter_by(name="resolver1").first() self.assertTrue(r1.rtype == "passwdresolver", r1.rtype) realm = Realm("realm1") realm.save() # Put the resolver into the realm rrealm = ResolverRealm(resolver_name="resolver1", realm_name="realm1") rrealm.save()