Skip to content

Commit

Permalink
Fix credential list (#98)
Browse files Browse the repository at this point in the history
* Update to the new endpoint for listing credentials

Signed-off-by: pfeairheller <pfeairheller@gmail.com>

* Fix test

Signed-off-by: pfeairheller <pfeairheller@gmail.com>

---------

Signed-off-by: pfeairheller <pfeairheller@gmail.com>
  • Loading branch information
pfeairheller authored Nov 15, 2023
1 parent 0b892d5 commit ff48ddd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/list_person_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def list_credentials():
print(aid)
credentials = client.credentials()

creds = credentials.list("BankUser", filtr={'-a-i': aid})
creds = credentials.list(filtr={'-a-i': aid})
print(creds)
assert len(creds) == 1

Expand Down
5 changes: 2 additions & 3 deletions src/signify/app/credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ def __init__(self, client: SignifyClient):
"""
self.client = client

def list(self, name, filtr=None, sort=None, skip=None, limit=None):
def list(self, filtr=None, sort=None, skip=None, limit=None):
"""
Parameters:
name (str): Alias associated with the AID
filtr (dict): Credential filter dict
sort(list): list of SAD Path field references to sort by
skip (int): number of credentials to skip at the front of the list
Expand All @@ -142,7 +141,7 @@ def list(self, name, filtr=None, sort=None, skip=None, limit=None):
limt=limit
)

res = self.client.post(f"/identifiers/{name}/credentials/query", json=json)
res = self.client.post(f"/credentials/query", json=json)
return res.json()

def export(self, name, said):
Expand Down
6 changes: 3 additions & 3 deletions tests/app/test_credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def test_credentials_list():

from requests import Response
mock_response = mock({'json': lambda: {}}, spec=Response, strict=True)
expect(mock_client, times=1).post('/identifiers/aid1/credentials/query',
expect(mock_client, times=1).post('/credentials/query',
json={'filter': {'genre': 'horror'},
'sort': ['updside down'], 'skip': 10, 'limt': 10}).thenReturn(mock_response)

from signify.app.credentialing import Credentials
Credentials(client=mock_client).list('aid1', filtr={'genre': 'horror'}, sort=['updside down'], skip=10,
Credentials(client=mock_client).list(filtr={'genre': 'horror'}, sort=['updside down'], skip=10,
limit=10) # type: ignore

verify(mock_response, times=1).json()
Expand All @@ -83,7 +83,7 @@ def test_credentials_list():
unstub()


def test_credentials_query():
def test_credentials_export():
from signify.app.clienting import SignifyClient
mock_client = mock(spec=SignifyClient, strict=True)

Expand Down

0 comments on commit ff48ddd

Please sign in to comment.