def test_2(): authz_db = MemPermDescDB() res = authz_db.match( resource_set_id="https://idp.catalogix.se/id/[email protected]", entity="https://lingon.ladok.umu.se:8087/sp.xml") assert res == []
def test_1(): authz_db = MemPermDescDB() rid = authz_db.store(RSD) item = authz_db.find_one({'_id': rid}) assert item assert isinstance(item, PermissionDescription) for key, val in list(RSD.items()): assert key in item assert item[key] == val assert authz_db.read(resource_set_id="phoney") == [] res = authz_db.match( resource_set_id="https://idp.catalogix.se/id/[email protected]") assert res res = authz_db.match( resource_set_id="https://idp.catalogix.se/id/[email protected]", scopes=["%s/givenName/Roland" % ATTR]) assert res res = authz_db.match( resource_set_id="https://idp.catalogix.se/id/[email protected]", scopes=["%s/sn/Magnusson" % ATTR]) assert res == [] rols = authz_db.read(entity="https://lingon.ladok.umu.se:8087/sp.xml") assert rols authz_db.remove(pid=rid) assert authz_db.match( resource_set_id="https://idp.catalogix.se/id/[email protected]") == []