diff --git a/setup.py b/setup.py index bc46961..879cf35 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ tests_require=[ 'responses>=0.22.0', 'coverage>=6.5.0', - 'pytest==7.2.0', + 'pytest>=7.2.0', 'mockito==1.4.0' ], setup_requires=[ diff --git a/src/signify/app/aiding.py b/src/signify/app/aiding.py index 7fd8d76..7f2006f 100644 --- a/src/signify/app/aiding.py +++ b/src/signify/app/aiding.py @@ -34,6 +34,10 @@ def list(self, start=0, end=24): def get(self, name): res = self.client.get(f"/identifiers/{name}") return res.json() + + def rename(self, name, newName): + res = self.client.put(f"/identifiers/{name}", json={"name": newName}) + return res.json() def create(self, name, transferable=True, isith="1", nsith="1", wits=None, toad="0", proxy=None, delpre=None, dcode=MtrDex.Blake3_256, data=None, algo=Algos.salty, estOnly=False, DnD=False, **kwargs): @@ -104,7 +108,7 @@ def update(self, name, typ, **kwas): pass def delete(self, name): - pass + self.client.delete(f"/identifiers/{name}") def interact(self, name, data=None): hab = self.get(name) @@ -125,7 +129,7 @@ def interact(self, name, data=None): sigs=sigs) json[keeper.algo] = keeper.params() - res = self.client.put(f"/identifiers/{name}?type=ixn", json=json) + res = self.client.post(f"/identifiers/{name}/events", json=json) return serder, sigs, res.json() def rotate(self, name, *, transferable=True, nsith=None, toad=None, cuts=None, adds=None, @@ -188,7 +192,7 @@ def rotate(self, name, *, transferable=True, nsith=None, toad=None, cuts=None, a if rstates is not None: json['rmids'] = [state['i'] for state in rstates] - res = self.client.put(f"/identifiers/{name}", json=json) + res = self.client.post(f"/identifiers/{name}/events", json=json) return serder, sigs, res.json() def addEndRole(self, name, *, role=Roles.agent, eid=None, stamp=None): diff --git a/tests/app/test_aiding.py b/tests/app/test_aiding.py index 203943e..d979016 100644 --- a/tests/app/test_aiding.py +++ b/tests/app/test_aiding.py @@ -263,6 +263,10 @@ def test_aiding_delete(): from signify.app.aiding import Identifiers ids = Identifiers(client=mock_client) # type: ignore + from requests import Response + mock_response = mock({'json': lambda: {'success': 'yay'}}, spec=Response, strict=True) + expect(mock_client, times=1).delete('/identifiers/aid1').thenReturn(mock_response) + ids.delete(name='aid1') verifyNoUnwantedInteractions() @@ -299,7 +303,7 @@ def test_aiding_interact_no_data(): } from requests import Response mock_response = mock({'json': lambda: {'success': 'yay'}}, spec=Response, strict=True) - expect(mock_client, times=1).put('/identifiers/aid1?type=ixn', json=expected_data).thenReturn(mock_response) + expect(mock_client, times=1).post('/identifiers/aid1/events', json=expected_data).thenReturn(mock_response) ids.interact(name='aid1') @@ -342,7 +346,7 @@ def test_aiding_interact_with_data(): from requests import Response mock_response = mock({'json': lambda: {'success': 'yay'}}, spec=Response, strict=True) - expect(mock_client, times=1).put('/identifiers/aid1?type=ixn', json=expected_data).thenReturn(mock_response) + expect(mock_client, times=1).post('/identifiers/aid1/events', json=expected_data).thenReturn(mock_response) ids.interact(name='aid1', data=[{'some': 'data'}, {'some': 'more'}]) @@ -390,7 +394,7 @@ def test_aiding_rotate(): mock_response = mock(spec=Response, strict=True) expected_data = {'rot': {'a': 'key event dictionary'}, 'sigs': ['a signature'], 'salty': {'keeper': 'params'}, 'smids': ['state 1', 'state 2'], 'rmids': ['rstate 1', 'rstate 2']} - expect(mock_client, times=1).put('/identifiers/aid1', json=expected_data).thenReturn(mock_response) + expect(mock_client, times=1).post('/identifiers/aid1/events', json=expected_data).thenReturn(mock_response) expect(mock_response, times=1).json().thenReturn({'success': 'yay'}) _, _, out = ids.rotate(name='aid1', states=[{'i': 'state 1'}, {'i': 'state 2'}], diff --git a/tests/core/test_authing.py b/tests/core/test_authing.py index f66efda..27240d8 100644 --- a/tests/core/test_authing.py +++ b/tests/core/test_authing.py @@ -172,7 +172,7 @@ def test_approve_delegation(): }) from keri.core import coring - e1 = dict(v=coring.Vstrings.json, + e1 = dict(v="KERI10JSON000000_", d="", i="ABCDEFG", s="1",