Skip to content

Commit abcfb8e

Browse files
author
Yuki I
committed
test: fix and complete tests revocation tests
1 parent dd4ee76 commit abcfb8e

File tree

3 files changed

+3002
-4
lines changed

3 files changed

+3002
-4
lines changed

acapy_agent/anoncreds/default/legacy_indy/tests/test_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ async def test_register_revocation_list_with_author_role(
921921
),
922922
),
923923
)
924-
@mock.patch.object(AskarAnoncredsProfileSession, "handle")
924+
@mock.patch.object(AskarAnonCredsProfileSession, "handle")
925925
async def test_register_revocation_list_passes_profile(
926926
self, mock_askar_handle, mock_get_ledger_for_id
927927
):

acapy_agent/anoncreds/tests/test_revocation.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
from ...utils.testing import create_test_profile
3939
from .. import revocation as test_module
4040

41+
from ...tails.base import BaseTailsServer
42+
4143
rev_reg_def = RevRegDef(
4244
tag="tag",
4345
cred_def_id="CsQY9MGeD3CQP4EyuVFo5m:3:CL:14951:MYCO_Biomarker",
@@ -839,12 +841,13 @@ async def test_upload_tails_file(self):
839841
return_value=(True, "https://tails-server.com")
840842
)
841843

842-
# valid
844+
# valid case
843845
with mock.patch.object(
844846
test_module,
845847
"AnonCredsTailsServer",
846848
mock.MagicMock(return_value=tails_server),
847849
):
850+
self.profile.context.injector.bind_instance(BaseTailsServer, tails_server)
848851
await self.revocation.upload_tails_file(rev_reg_def)
849852
tails_server.upload_tails_file.assert_called_once()
850853

@@ -861,14 +864,14 @@ async def test_upload_tails_file(self):
861864
),
862865
self.assertRaises(test_module.AnonCredsRevocationError),
863866
):
867+
self.profile.context.injector.bind_instance(BaseTailsServer, tails_server)
864868
await self.revocation.upload_tails_file(rev_reg_def)
865869

870+
# tails location mismatch
866871
tails_server.upload_tails_file.reset_mock()
867872
tails_server.upload_tails_file = mock.CoroutineMock(
868873
return_value=(None, "not-https://tails-server.com")
869874
)
870-
871-
# tails location does not match
872875
with (
873876
mock.patch.object(
874877
test_module,
@@ -877,6 +880,7 @@ async def test_upload_tails_file(self):
877880
),
878881
self.assertRaises(test_module.AnonCredsRevocationError),
879882
):
883+
self.profile.context.injector.bind_instance(BaseTailsServer, tails_server)
880884
await self.revocation.upload_tails_file(rev_reg_def)
881885

882886
@mock.patch.object(AskarAnonCredsProfileSession, "handle")

0 commit comments

Comments
 (0)