diff --git a/src/keria/app/ipexing.py b/src/keria/app/ipexing.py index 8b79d4a1..aff11d5c 100644 --- a/src/keria/app/ipexing.py +++ b/src/keria/app/ipexing.py @@ -169,7 +169,7 @@ def on_post(req, rep, name): case "/ipex/grant": IpexGrantCollectionEnd.sendGrant(agent, hab, ked, sigs, rec) case "/multisig/exn": - IpexGrantCollectionEnd.sendMultisigExn(agent, hab, ked, atc, rec) + IpexGrantCollectionEnd.sendMultisigExn(agent, hab, ked, sigs, atc, rec) rep.status = falcon.HTTP_202 rep.data = json.dumps(ked).encode("utf-8") diff --git a/tests/app/test_ipexing.py b/tests/app/test_ipexing.py index 9a67809c..011d4f86 100644 --- a/tests/app/test_ipexing.py +++ b/tests/app/test_ipexing.py @@ -291,3 +291,56 @@ def test_ipex_grant(helpers, mockHelpingNowIso8601, seeder): res = client.simulate_post(path="/identifiers/legal-entity/ipex/grant", body=data) assert res.status_code == 202 assert res.json == exn.ked + assert len(agent.exchanges) == 1 + assert len(agent.grants) == 1 + + ims = eventing.messagize(serder=exn, sigers=[coring.Siger(qb64=sigs[0])]) + # Test sending embedded admit in multisig/exn message + exn, end = exchanging.exchange(route="/multisig/exn", + payload=dict(), + sender=le['i'], + embeds=dict(exn=ims), + date=helping.nowIso8601()) + + # Bad recipient + body = dict( + exn=exn.ked, + sigs=sigs, + atc=dict(exn=end.decode("utf-8")), + rec=["EZ-i0d8JZAoTNZH3ULaU6JR2nmwyvYAfSVPzhzS6b5CM"] + ) + + data = json.dumps(body).encode("utf-8") + res = client.simulate_post(path="/identifiers/legal-entity/ipex/grant", body=data) + assert res.status_code == 400 + assert res.json == {'description': 'attempt to send to unknown ' + 'AID=EZ-i0d8JZAoTNZH3ULaU6JR2nmwyvYAfSVPzhzS6b5CM', + 'title': '400 Bad Request'} + + # Bad attachments + body = dict( + exn=exn.ked, + sigs=sigs, + atc=dict(bad=end.decode("utf-8")), + rec=[pre1] + ) + + data = json.dumps(body).encode("utf-8") + res = client.simulate_post(path="/identifiers/legal-entity/ipex/grant", body=data) + assert res.status_code == 400 + assert res.json == {'description': 'attachment missing for ACDC, unable to process request.', + 'title': '400 Bad Request'} + + body = dict( + exn=exn.ked, + sigs=sigs, + atc=dict(exn=end.decode("utf-8")), + rec=[pre1] + ) + + data = json.dumps(body).encode("utf-8") + res = client.simulate_post(path="/identifiers/legal-entity/ipex/grant", body=data) + + assert res.status_code == 202 + assert len(agent.exchanges) == 3 + assert len(agent.grants) == 2