unittest.mock.assert_not_called

Here are the examples of the python api unittest.mock.assert_not_called taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

3 Source : tests.py
with BSD 2-Clause "Simplified" License
from django-auth-ldap

    def test_start_tls_missing(self, mock):
        self._init_settings(
            USER_DN_TEMPLATE="uid=%(user)s,ou=people,o=test", START_TLS=False
        )

        authenticate(username="alice", password="password")
        mock.assert_not_called()

    @spy_ldap("start_tls_s")

3 Source : tests.py
with BSD 2-Clause "Simplified" License
from django-auth-ldap

    def test_deny_empty_password(self, mock):
        self._init_settings(USER_DN_TEMPLATE="uid=%(user)s,ou=people,o=test")

        with self.assertLogs("django_auth_ldap", level=logging.DEBUG) as logs:
            alice = authenticate(username="alice", password="")

        self.assertIsNone(alice)
        mock.assert_not_called()

        self.assertEqual(
            [(log.levelname, log.msg, log.args) for log in logs.records],
            [("DEBUG", "Rejecting empty password for %s", ("alice",))],
        )

    @spy_ldap("simple_bind_s")