AuthUser is a class which contains the delete method. I want to test if the mock delete method calls a function, given the arguments for the method.
@mock.patch.object(AuthUser, 'delete')
@mock.patch('oscadmin.common.oscp.deactivate_user')
def test_delete(self, deactivate_user_mock, delete_mock):
"""Test the delete() method in AuthUser"""
authUserObject = mock.Mock()
authUserObject.oscp_id = 4
"""If delete_from_oscp = True && oscp_id isset"""
delete_mock(self, True, authUserObject, mock.Mock())
self.assertTrue(authUserObject.oscp_id)
Aucun commentaire:
Enregistrer un commentaire