From 59a39795ee3f10be19202f904245d730136d493f Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 12:58:44 -0300 Subject: [PATCH 1/3] rename and delete aids --- src/signify/app/aiding.py | 10 +++++++--- tests/app/test_aiding.py | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) 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'}], From c5a29381a58c901436953620a2827399e9570fa3 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 13:13:03 -0300 Subject: [PATCH 2/3] vstring fix --- tests/core/test_authing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/core/test_authing.py b/tests/core/test_authing.py index b6b5574..5fd8f08 100644 --- a/tests/core/test_authing.py +++ b/tests/core/test_authing.py @@ -131,7 +131,7 @@ def test_controller_derive(): assert serder.raw == raw from keri.core import coring - e1 = dict(v=coring.Vstrings.json, + e1 = dict(v="KERI10JSON000000_", t="rot", d="", i="EMPYj-h2OoCyPGQoUUd1tLUYe62YD_8A3jjXxqYawLcV", @@ -171,7 +171,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", From 7766ab19d8a863959ef654e388b6ed4cbdb57e29 Mon Sep 17 00:00:00 2001 From: Rodolfo Miranda Date: Sat, 30 Mar 2024 13:16:45 -0300 Subject: [PATCH 3/3] mockito version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5a51474..e6c0be2 100644 --- a/setup.py +++ b/setup.py @@ -79,7 +79,7 @@ 'responses>=0.22.0', 'coverage>=6.5.0', 'pytest>=7.2.0', - 'mockito>=1.4.0' + 'mockito==1.4.0' ], setup_requires=[ ],