Skip to content

Commit

Permalink
Update reference to KERI in development branches to point to the now …
Browse files Browse the repository at this point in the history
…published development releases of KERI on PyPi. (WebOfTrust#226)

Fixed broken tests from recent PRs and KERI branch confusion.

Signed-off-by: pfeairheller <[email protected]>
  • Loading branch information
pfeairheller authored Apr 6, 2024
1 parent eeafb71 commit 5f06007
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
python_requires='>=3.12.2',
install_requires=[
'hio>=0.6.12',
'keri @ git+https://[email protected]/weboftrust/keripy.git@development',
'keri>=1.2.0-dev0',
'mnemonic>=0.20',
'multicommand>=1.0.0',
'falcon>=3.1.3',
Expand Down
29 changes: 18 additions & 11 deletions src/keria/app/aiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def on_get(req, rep):

end = start + (len(res) - 1) if len(res) > 0 else 0
rep.set_header("Accept-Ranges", "aids")
rep.set_header("Content-Range", f"aids {start}-{end}/{count-1}")
rep.set_header("Content-Range", f"aids {start}-{end}/{count - 1}")
rep.content_type = "application/json"
rep.data = json.dumps(res).encode("utf-8")

Expand Down Expand Up @@ -483,17 +483,19 @@ def on_put(self, req, rep, name):
raise falcon.HTTPNotFound(title=f"No AID with name {name} found")
body = req.get_media()
newName = body.get("name")
habord = hab.db.habs.get(keys=name)
hab.db.habs.put(keys=newName,
val=habord)
hab.db.habs.rem(keys=name)
habord = hab.db.habs.get(keys=(hab.pre,))
habord.name = newName
hab.db.habs.pin(keys=(hab.pre,),
val=habord)
hab.db.names.pin(keys=("", newName), val=hab.pre)
hab.db.names.rem(keys=("", name))
hab.name = newName
hab = agent.hby.habByName(newName)
data = info(hab, agent.mgr, full=True)
rep.status = falcon.HTTP_200
rep.content_type = "application/json"
rep.data = json.dumps(data).encode("utf-8")

def on_delete(self, req, rep, name):
""" Identifier delete endpoint
Expand All @@ -509,7 +511,7 @@ def on_delete(self, req, rep, name):
hab = agent.hby.habByName(name)
if hab is None:
raise falcon.HTTPNotFound(title=f"No AID with name {name} found")
hab.db.habs.rem(keys=name)
agent.hby.deleteHab(name)
rep.status = falcon.HTTP_200

def on_post(self, req, rep, name):
Expand All @@ -532,7 +534,7 @@ def on_post(self, req, rep, name):
op = self.interact(agent, name, body)
else:
raise falcon.HTTPBadRequest(title="invalid request",
description=f"required field 'rot' or 'ixn' missing from request")
description=f"required field 'rot' or 'ixn' missing from request")

rep.status = falcon.HTTP_200
rep.content_type = "application/json"
Expand Down Expand Up @@ -709,7 +711,8 @@ def on_get(req, rep, name):
if role in (kering.Roles.witness,): # Fetch URL OOBIs for all witnesses
oobis = []
for wit in hab.kever.wits:
urls = hab.fetchUrls(eid=wit, scheme=kering.Schemes.http) or hab.fetchUrls(eid=wit, scheme=kering.Schemes.https)
urls = hab.fetchUrls(eid=wit, scheme=kering.Schemes.http) or hab.fetchUrls(eid=wit,
scheme=kering.Schemes.https)
if not urls:
raise falcon.HTTPNotFound(description=f"unable to query witness {wit}, no http endpoint")

Expand All @@ -719,7 +722,8 @@ def on_get(req, rep, name):
res["oobis"] = oobis
elif role in (kering.Roles.controller,): # Fetch any controller URL OOBIs
oobis = []
urls = hab.fetchUrls(eid=hab.pre, scheme=kering.Schemes.http) or hab.fetchUrls(eid=hab.pre, scheme=kering.Schemes.https)
urls = hab.fetchUrls(eid=hab.pre, scheme=kering.Schemes.http) or hab.fetchUrls(eid=hab.pre,
scheme=kering.Schemes.https)
if not urls:
raise falcon.HTTPNotFound(description=f"unable to query controller {hab.pre}, no http endpoint")

Expand All @@ -728,7 +732,10 @@ def on_get(req, rep, name):
oobis.append(urljoin(up.geturl(), f"/oobi/{hab.pre}/controller"))
res["oobis"] = oobis
elif role in (kering.Roles.agent,): # Fetch URL OOBIs for all witnesses
roleUrls = hab.fetchRoleUrls(cid=hab.pre, role=kering.Roles.agent, scheme=kering.Schemes.http) or hab.fetchRoleUrls(cid=hab.pre, role=kering.Roles.agent, scheme=kering.Schemes.https)
roleUrls = hab.fetchRoleUrls(cid=hab.pre, role=kering.Roles.agent,
scheme=kering.Schemes.http) or hab.fetchRoleUrls(cid=hab.pre,
role=kering.Roles.agent,
scheme=kering.Schemes.https)
if kering.Roles.agent not in roleUrls:
res['oobis'] = []
else:
Expand Down
3 changes: 1 addition & 2 deletions tests/app/test_aiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def test_identifier_collection_end(helpers):
'salty': {'stem': 'signify:aid', 'pidx': 0, 'tier': 'low', 'sxlt': sxlt,
'icodes': [MtrDex.Ed25519_Seed], 'ncodes': [MtrDex.Ed25519_Seed]}
}
res = client.simulate_put(path="/identifiers/aid1", body=json.dumps(body))
res = client.simulate_post(path="/identifiers/aid1/events", body=json.dumps(body))
assert res.status_code == 500

# Test with witnesses
Expand Down Expand Up @@ -419,7 +419,6 @@ def test_identifier_collection_end(helpers):
assert res.status_code == 200
assert res.json['done'] is False


assert len(agent.witners) == 1
res = client.simulate_get(path="/identifiers")
assert res.status_code == 200
Expand Down

0 comments on commit 5f06007

Please sign in to comment.