-
-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Description
Hi,
I tried to mock the input type of a function create_service in services.py .
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)
I am setting up a mock with when and then using verify to 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
Metadata
Metadata
Assignees
Labels
No labels