def test_create_store(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) assert store is not None assert store.size() == 0 assert len(store.collections()) == 0 assert str(store) assert not store.attributes()
def test_search_swamid(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.swamid, etag='test01', lazy=False) for q in ('sunet', 'sunet.se', 'nordunet', 'miun'): e = list(store.search(q)) assert len(e) != 0 assert e[0] is not None assert e[0].get('entityID') is not None
def test_lookup_intersect_test01(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.test01, etag='test01', lazy=False) entity_id = root(self.test01).get('entityID') e = store.lookup("%s=%s+%s=%s" % (ATTRS['domain'], 'example.com', ATTRS['role'], 'idp')) assert len(e) == 1 assert e[0] is not None assert e[0].get('entityID') is not None assert e[0].get('entityID') == entity_id
def test_lookup_test01(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.test01, etag='test01', lazy=False) entity_id = root(self.test01).get('entityID') e = store.lookup(entity_id) assert len(e) == 1 assert e[0] is not None assert e[0].get('entityID') is not None assert e[0].get('entityID') == entity_id
def test_store_attributes_test01(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.test01, etag='test01', lazy=False) print(store.attributes()) assert ATTRS['domain'] in store.attributes() assert ATTRS['role'] in store.attributes() assert ATTRS['collection'] not in store.attributes() assert 'example.com' in store.attribute(ATTRS['domain']) assert 'example.net' in store.attribute(ATTRS['domain']) assert 'foo.com' not in store.attribute(ATTRS['domain'])
def test_search_test01(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.test01, etag='test01', lazy=False) entity_id = root(self.test01).get('entityID') for q in ('example', 'Example', 'university'): e = list(store.search(q)) assert len(e) == 1 assert e[0] is not None assert e[0].get('entityID') is not None assert e[0].get('entityID') == entity_id
def test_import_reset_test01(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.test01, etag="test01") assert store.size() > 0 store.reset() print(store.size()) assert store.size() == 0
def test_import_reset_wayf(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.wayf, tid='https://metadata.wayf.dk/wayf-edugain-metadata.xml') assert (store.size() == 77) store.reset() assert (store.size() == 0)
def test_lookup_wayf(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.wayf, tid='https://metadata.wayf.dk/wayf-edugain-metadata.xml') assert store.size() == 77 res = store.lookup("entities") lst = [e.get('entityID') for e in res] assert len(lst) == 77 assert 'https://birk.wayf.dk/birk.php/wayf.supportcenter.dk/its/saml2/idp/metadata.php?unit=its' in lst
def test_lookup_wayf_sha1(self): store = RedisWhooshStore(directory=self.dir, clear=True, name="test", redis=fakeredis.FakeStrictRedis()) store.update(self.wayf, tid='https://metadata.wayf.dk/wayf-edugain-metadata.xml', lazy=False) assert store.size() == 77 res = store.lookup("{sha1}4ece490318a017bc2cc24674f5ad049ad562f7b2") lst = [e.get('entityID') for e in res] assert len(lst) == 1 assert 'https://birk.wayf.dk/birk.php/wayf.supportcenter.dk/its/saml2/idp/metadata.php?unit=its' in lst