38
38
from ...utils .testing import create_test_profile
39
39
from .. import revocation as test_module
40
40
41
+ from ...tails .base import BaseTailsServer
42
+
41
43
rev_reg_def = RevRegDef (
42
44
tag = "tag" ,
43
45
cred_def_id = "CsQY9MGeD3CQP4EyuVFo5m:3:CL:14951:MYCO_Biomarker" ,
@@ -839,12 +841,13 @@ async def test_upload_tails_file(self):
839
841
return_value = (True , "https://tails-server.com" )
840
842
)
841
843
842
- # valid
844
+ # valid case
843
845
with mock .patch .object (
844
846
test_module ,
845
847
"AnonCredsTailsServer" ,
846
848
mock .MagicMock (return_value = tails_server ),
847
849
):
850
+ self .profile .context .injector .bind_instance (BaseTailsServer , tails_server )
848
851
await self .revocation .upload_tails_file (rev_reg_def )
849
852
tails_server .upload_tails_file .assert_called_once ()
850
853
@@ -861,14 +864,14 @@ async def test_upload_tails_file(self):
861
864
),
862
865
self .assertRaises (test_module .AnonCredsRevocationError ),
863
866
):
867
+ self .profile .context .injector .bind_instance (BaseTailsServer , tails_server )
864
868
await self .revocation .upload_tails_file (rev_reg_def )
865
869
870
+ # tails location mismatch
866
871
tails_server .upload_tails_file .reset_mock ()
867
872
tails_server .upload_tails_file = mock .CoroutineMock (
868
873
return_value = (None , "not-https://tails-server.com" )
869
874
)
870
-
871
- # tails location does not match
872
875
with (
873
876
mock .patch .object (
874
877
test_module ,
@@ -877,6 +880,7 @@ async def test_upload_tails_file(self):
877
880
),
878
881
self .assertRaises (test_module .AnonCredsRevocationError ),
879
882
):
883
+ self .profile .context .injector .bind_instance (BaseTailsServer , tails_server )
880
884
await self .revocation .upload_tails_file (rev_reg_def )
881
885
882
886
@mock .patch .object (AskarAnonCredsProfileSession , "handle" )
0 commit comments