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

Fix mockito version #112

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10.4
- name: Set up Python 3.12.1
uses: actions/setup-python@v2
with:
python-version: 3.10.4
python-version: 3.12.1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest mockito pytest-cov codecov
pip install pytest mockito==1.4.0 pytest-cov codecov
pip install -r requirements.txt
- name: Run tests
run: |
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
],
python_requires='>=3.10.4',
python_requires='>=3.12.1',
install_requires=[
'keri>=1.1.0',
'keri @ git+https://git@github.com/weboftrust/keripy.git@development',
'multicommand>=1.0.0',
'requests>=2.28',
'http_sfv>=0.9.8',
Expand Down
10 changes: 4 additions & 6 deletions src/signify/app/challenging.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ def respond(self, name, recp, words):

return res

def verify(self, name, source, words):
def verify(self, source, words):
""" Ask Agent to verify a given sender signed the provided words

Parameters:
name (str): human readable name of AID environment
source(str): qb64 AID of source of challenge response to check for
words(list): list of challenge words to check for
"""
Expand All @@ -54,14 +53,13 @@ def verify(self, name, source, words):
words=words
)

res = self.client.post(f"/challenges/{name}/verify/{source}", json=json)
res = self.client.post(f"/challenges_verify/{source}", json=json)
return res.json()

def responded(self, name, source, said):
def responded(self, source, said):
""" Mark challenge response as signed and accepted

Parameters:
name (str): human readable name of AID environment
source (str): qb64 AID of signer
said (str): qb64 AID of exn message representing the signed response

Expand All @@ -73,5 +71,5 @@ def responded(self, name, source, said):
said=said
)

self.client.put(f"/challenges/{name}/verify/{source}", json=json)
self.client.put(f"/challenges_verify/{source}", json=json)
return True
7 changes: 3 additions & 4 deletions src/signify/app/credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def create(self, hab, registryName, noBackers=True, estOnly=False, baks=None, to

cnfg = []
if noBackers:
cnfg.append(TraitDex.NoBackers)
cnfg.append(TraitDex.NoRegistrarBackers)
if estOnly:
cnfg.append(TraitDex.EstOnly)

Expand Down Expand Up @@ -144,19 +144,18 @@ def list(self, filtr=None, sort=None, skip=None, limit=None):
res = self.client.post(f"/credentials/query", json=json)
return res.json()

def export(self, name, said):
def export(self, said):
"""

Parameters:
name (str): Name associated with the AID
said (str): SAID of credential to export
Returns:
credential (bytes): exported credential

"""
headers = dict(accept="application/json+cesr")

res = self.client.get(f"/identifiers/{name}/credentials/{said}", headers=headers)
res = self.client.get(f"/credentials/{said}", headers=headers)
return res.content

def create(self, hab, registry, data, schema, recipient=None, edges=None, rules=None, private=False,
Expand Down
8 changes: 4 additions & 4 deletions tests/app/test_challenging.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def test_challenge_verify():
words = ["word", "one", "two", "three"]
from requests import Response
mock_response = mock({}, spec=Response, strict=True)
expect(mock_client, times=1).post(f'/challenges/{name}/verify/{source}',
expect(mock_client, times=1).post(f'/challenges_verify/{source}',
json=dict(words=words)).thenReturn(mock_response)
expect(mock_response, times=1).json().thenReturn(
{"done": False}
)

out = chas.verify(name, source, words)
out = chas.verify(source, words)
assert out["done"] is False

verifyNoUnwantedInteractions()
Expand All @@ -67,10 +67,10 @@ def test_challenge_responded():
said = "E456"
from requests import Response
mock_response = mock({}, spec=Response, strict=True)
expect(mock_client, times=1).put(f'/challenges/{name}/verify/{source}',
expect(mock_client, times=1).put(f'/challenges_verify/{source}',
json=dict(said=said)).thenReturn(mock_response)

out = chas.responded(name, source, said)
out = chas.responded(source, said)
assert out is True

verifyNoUnwantedInteractions()
Expand Down
4 changes: 2 additions & 2 deletions tests/app/test_credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ def test_credentials_export():

from requests import Response
mock_response = mock({'content': 'things I found'}, spec=Response, strict=True)
expect(mock_client, times=1).get('/identifiers/aid1/credentials/a_said',
expect(mock_client, times=1).get('/credentials/a_said',
headers={'accept': 'application/json+cesr'}).thenReturn(mock_response)

from signify.app.credentialing import Credentials
out = Credentials(client=mock_client).export('aid1', 'a_said') # type: ignore
out = Credentials(client=mock_client).export('a_said') # type: ignore

assert out == 'things I found'

Expand Down
Loading