from mockito import verify, when, ANY, not_
from .api import services
from .models import Token
class TestCreateServicePrincipal(TestCase):
def test_input_name_service_principal(self):
when(services).create_service(ANY(Token), ANY(str), None, None, "p",False).thenReturn(1)
when(services).create_service(not_(ANY(Token)), ANY(str), None, None, "p",False).thenRaise(TypeError)
when(services).create_service(ANY(Token), not_( ANY(str)), None, None, "p",False).thenRaise(TypeError)
when(services).create_service(not_(ANY(Token)), not_( ANY(str)), None, None, "p",False).thenRaise(TypeError)
verify(services).create_service(ANY(Token), ANY(str), None, None, "p",False)
#verify(services).create_service(not_(ANY(Token)), ANY(str), None, None, "p",False)
#verify(services).create_service(ANY(Token), not_( ANY(str)), None, None, "p",False).thenRaise(TypeError)
#verify(services).create_service(not_(ANY(Token)), not_( ANY(str)), None, None, "p",False).thenRaise(TypeError)
Hi,
I tried to mock the input type of a function
create_serviceinservices.py.I am setting up a mock with
whenand then usingverifyto evaluate the valid or invalid inputs but I got the following error. Is there any way I can fix the error?mockito.verification.VerificationError: Wanted but not invoked: create_service(<Any: <class 'Token'>>, <Any: <class 'str'>>, None, None, 'p', False) Instead got: Nothing