summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-05-04 16:01:20 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-04 16:01:20 +0200
commit61e53980ae71511f4c538252a571e8cd54eb0712 (patch)
treea37e80cac542f18046a928761828399bacc13291 /tests
parentf63162347c6f33e1e3db9c49fa154de821dd828d (diff)
downloadpykolab-61e53980ae71511f4c538252a571e8cd54eb0712.tar.gz
Fix encoding errors also for cache updates (#5143)
Summary: The fix in a9aa9c2650 missed encoding conversion for UPDATE queries Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Differential Revision: https://git.kolab.org/D138
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test-020-auth_cache.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/unit/test-020-auth_cache.py b/tests/unit/test-020-auth_cache.py
index d30d403..ff9ed20 100644
--- a/tests/unit/test-020-auth_cache.py
+++ b/tests/unit/test-020-auth_cache.py
@@ -111,3 +111,49 @@ class TestAuthCache(unittest.TestCase):
result = auth_cache.get_entry('v' + 'e'*512 + 'rylongkey')
self.assertEqual(result, 'v' + 'e'*512 + 'rylongvalue')
+
+ def test_006_plain_update(self):
+ auth_cache.set_entry(
+ 'somekey',
+ 'ou=People,dc=example,dc=org2'
+ )
+
+ result = auth_cache.get_entry('somekey')
+ self.assertEqual(result, 'ou=People,dc=example,dc=org2')
+
+ def test_007_plain_encoding_update(self):
+ auth_cache.set_entry(
+ 'somekey2',
+ 'ou=Geschäftsbereich,ou=People,dc=example,dc=org2'
+ )
+
+ result = auth_cache.get_entry('somekey2')
+ self.assertEqual(result, 'ou=Gesch\xc3\xa4ftsbereich,ou=People,dc=example,dc=org2')
+
+ def test_008_unicode_update(self):
+ auth_cache.set_entry(
+ 'somekey3',
+ u'ou=Geschäftsbereich,ou=People,dc=example,dc=org2'
+ )
+
+ result = auth_cache.get_entry('somekey3')
+ self.assertEqual(result, 'ou=Gesch\xc3\xa4ftsbereich,ou=People,dc=example,dc=org2')
+
+ @unittest.skip("Double encoding or decoding")
+ def test_009_unicode_escape_update(self):
+ auth_cache.set_entry(
+ 'somekey4',
+ u'ou=Gesch\xc3\xa4ftsbereich,ou=People,dc=example,dc=org2'
+ )
+
+ result = auth_cache.get_entry('somekey4')
+ self.assertEqual(result, u'ou=Gesch\xc3\xa4ftsbereich,ou=People,dc=example,dc=org2')
+
+ def test_010_longkey_update(self):
+ auth_cache.set_entry(
+ 'v' + 'e'*512 + 'rylongkey',
+ 'v' + 'e'*512 + 'rylongvalue2'
+ )
+
+ result = auth_cache.get_entry('v' + 'e'*512 + 'rylongkey')
+ self.assertEqual(result, 'v' + 'e'*512 + 'rylongvalue2')