How do I check if a function is called in a mock method?
<p>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.</p>

<pre><code>@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 &amp;&amp; oscp_id isset"""
    delete_mock(self, True, authUserObject, mock.Mock())
    self.assertTrue(authUserObject.oscp_id)
</code></pre>

<pre><code>delete_mock.method_expected_to_be_called.assert_called_once_with(args, kwargs)
</code></pre>

python django python-2.7 unit-testing django-models