tests: adds fail test
This commit is contained in:
parent
c4e8a9c7cc
commit
27e90c24cd
1 changed files with 11 additions and 0 deletions
|
|
@ -39,3 +39,14 @@ class TestLdapDao(unittest.TestCase):
|
||||||
self.ldap_dao.fetch_all()
|
self.ldap_dao.fetch_all()
|
||||||
|
|
||||||
conn.unbind_s.assert_called_once()
|
conn.unbind_s.assert_called_once()
|
||||||
|
|
||||||
|
@patch.object(LdapDao, "_get_ldap_conn")
|
||||||
|
def test_fetch_all_release_connection_on_error(self, _get_ldap_conn_mock, ldap_mock):
|
||||||
|
conn = MagicMock()
|
||||||
|
_get_ldap_conn_mock.return_value = conn
|
||||||
|
conn.search_ext_s.side_effect = Exception("Test exception")
|
||||||
|
|
||||||
|
res = self.ldap_dao.fetch_all()
|
||||||
|
|
||||||
|
assert res is None
|
||||||
|
conn.unbind_s.assert_called_once()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue