3838from ...utils .testing import create_test_profile
3939from .. import revocation as test_module
4040
41+ from ...tails .base import BaseTailsServer
42+
4143rev_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