Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #120 from dbluhm/fix/holder-get-cred-list
Browse files Browse the repository at this point in the history
fix: holder cred-get-list returns only holder creds
  • Loading branch information
dbluhm authored Jan 17, 2022
2 parents 8592b36 + b4ce3a2 commit 1501b1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion acapy_plugin_toolbox/holder/v0_1/messages/cred_get_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ async def handle(self, context: RequestContext, responder: BaseResponder):
"""Handle received get cred list request."""
session = await context.session()

credentials = await CredExRecord.query(session)
credentials = await CredExRecord.query(
session, post_filter_positive={"role": CredExRecord.ROLE_HOLDER}
)

if self.states:
credentials = [c for c in credentials if c.state in self.states]
Expand Down
10 changes: 5 additions & 5 deletions int/tests/test_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ async def test_credentials_get_list(
"@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/admin-holder/0.1/credentials-get-list"
}
)
cred_set = set([result.credential_exchange_id for result in cred.results])
cred_get_list_set = set(
[cred["credential_exchange_id"] for cred in credentials_get_list["results"]]
)
cred_set = {result.credential_exchange_id for result in cred.results}
cred_get_list_set = {
cred["credential_exchange_id"] for cred in credentials_get_list["results"]
}
assert (
credentials_get_list["@type"]
== "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/admin-holder/0.1/credentials-list"
)
assert cred_set.issubset(cred_get_list_set)
assert cred_get_list_set <= cred_set

0 comments on commit 1501b1f

Please sign in to comment.