Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a few AATH failures #1897

Merged
merged 5 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ async def mediation_record_for_connection(
or_default: bool = False,
):
"""Return relevant mediator for connection."""
async with profile.session() as session:
mediation_metadata = await conn_record.metadata_get(
session, MediationManager.METADATA_KEY, {}
)
mediation_id = (
mediation_metadata.get(MediationManager.METADATA_ID) or mediation_id
)
if conn_record.connection_id:
async with profile.session() as session:
mediation_metadata = await conn_record.metadata_get(
session, MediationManager.METADATA_KEY, {}
)
mediation_id = (
mediation_metadata.get(MediationManager.METADATA_ID) or mediation_id
)

mediation_record = await self.mediation_record_if_id(
profile, mediation_id, or_default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def mediation_route_manager():

@pytest.fixture
def conn_record():
record = ConnRecord()
record = ConnRecord(connection_id="12345")
record.metadata_get = mock.CoroutineMock(return_value={})
record.metadata_set = mock.CoroutineMock()
yield record
Expand Down
7 changes: 4 additions & 3 deletions aries_cloudagent/protocols/out_of_band/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,10 @@ async def create_invitation(
async with self.profile.session() as session:
await oob_record.save(session, reason="Created new oob invitation")

await self._route_manager.route_invitation(
self.profile, conn_rec, mediation_record
)
if conn_rec:
await self._route_manager.route_invitation(
self.profile, conn_rec, mediation_record
)

return InvitationRecord( # for return via admin API, not storage
oob_id=oob_record.oob_id,
Expand Down
3 changes: 2 additions & 1 deletion aries_cloudagent/revocation/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ async def revoke(request: web.BaseRequest):
body["notify"] = body.get("notify", context.settings.get("revocation.notify"))
notify = body.get("notify")
connection_id = body.get("connection_id")
notify_version = body.get("notify_version", "v1_0")
body["notify_version"] = body.get("notify_version", "v1_0")
notify_version = body["notify_version"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about this change - basically it changes aca-py behaviour to always send a revocation notification if the startup option is set (--notify-revocation) vs only sending if a notify_version is explicitly set in the revocation payload.

I assume that if you are notifying then you always want to notify.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that is right. And presumably if notify_version is not set, it should default to something -- e.g. the latest version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that is right. And presumably if notify_version is not set, it should default to something -- e.g. the latest version?

v1_0 is the default (it was the default before however the value wasn't getting passed through to the actual notification code so no notification was getting sent)


if notify and not connection_id:
raise web.HTTPBadRequest(reason="connection_id must be set when notify is true")
Expand Down