From 0f97d1d07cda072e59bc7789765a5879b8e0f34d Mon Sep 17 00:00:00 2001 From: kakwa Date: Thu, 28 May 2015 09:51:19 +0200 Subject: [PATCH] adding unit test for del user if user don't exist --- tests/test_BackendLdap.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_BackendLdap.py b/tests/test_BackendLdap.py index 4543976..a5a41a6 100644 --- a/tests/test_BackendLdap.py +++ b/tests/test_BackendLdap.py @@ -7,7 +7,7 @@ from __future__ import unicode_literals import pytest import sys from sets import Set -from ldapcherry.backend.backendLdap import Backend +from ldapcherry.backend.backendLdap import Backend, DelUserDontExists from ldapcherry.exceptions import * import cherrypy import logging @@ -168,6 +168,17 @@ class TestError(object): inv.del_user('test') raise AssertionError("expected an exception") + def testDelUserDontExists(self): + inv = Backend(cfg, cherrypy.log, 'ldap', attr) + try: + inv.del_user('test') + inv.del_user('test') + except DelUserDontExists: + return + else: + raise AssertionError("expected an exception") + + def testAddUserMissingMustAttribute(self): inv = Backend(cfg, cherrypy.log, 'ldap', attr) user = {