From 5d40cad3423e518d74de184f481664cda3827271 Mon Sep 17 00:00:00 2001 From: kakwa Date: Wed, 29 Jul 2015 00:09:32 +0200 Subject: [PATCH] adding utf-8 char in unit tests for ldap backend --- tests/test_BackendLdap.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_BackendLdap.py b/tests/test_BackendLdap.py index f00d40b..44923aa 100644 --- a/tests/test_BackendLdap.py +++ b/tests/test_BackendLdap.py @@ -170,9 +170,13 @@ class TestError(object): assert ret == expected def testAddUser(self): + try: + inv.del_user(u'test☭') + except: + pass inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid') user = { - 'uid': 'test', + 'uid': u'test☭', 'sn': 'test', 'cn': 'test', 'userPassword': 'test', @@ -181,12 +185,12 @@ class TestError(object): 'homeDirectory': '/home/test/' } inv.add_user(user) - inv.del_user('test') + inv.del_user(u'test☭') def testModifyUser(self): inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid') user = { - 'uid': 'test', + 'uid': u'test☭', 'sn': 'test', 'cn': 'test', 'userPassword': 'test', @@ -195,8 +199,8 @@ class TestError(object): 'homeDirectory': '/home/test/' } inv.add_user(user) - inv.set_attrs('test', {'gecos': 'test2', 'homeDirectory': '/home/test/'}) - inv.del_user('test') + inv.set_attrs(u'test☭', {'gecos': 'test2', 'homeDirectory': '/home/test/'}) + inv.del_user(u'test☭') def testAddUserDuplicate(self): inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')