summaryrefslogtreecommitdiffstats
path: root/tests/functional/test_wap_client
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-02-19 14:08:32 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-02-19 14:08:32 -0500
commit09da7edba58a0b7137f2a29f95bea5f5bfb7ac52 (patch)
tree60fb53252d7250f5034f52c9c54f1c44a3c54fe3 /tests/functional/test_wap_client
parenta22f4b8ef619b4dd8ea85c4248198ee8c4eae7ce (diff)
downloadpykolab-09da7edba58a0b7137f2a29f95bea5f5bfb7ac52.tar.gz
Add WAP client functions to manage resources + functional tests for them
Diffstat (limited to 'tests/functional/test_wap_client')
-rw-r--r--tests/functional/test_wap_client/test_008_resource_add.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/functional/test_wap_client/test_008_resource_add.py b/tests/functional/test_wap_client/test_008_resource_add.py
new file mode 100644
index 0000000..5647d0c
--- /dev/null
+++ b/tests/functional/test_wap_client/test_008_resource_add.py
@@ -0,0 +1,51 @@
+import time
+import pykolab
+
+from pykolab import wap_client
+from pykolab.auth import Auth
+from pykolab.imap import IMAP
+from twisted.trial import unittest
+
+import tests.functional.resource_func as funcs
+
+conf = pykolab.getConf()
+
+class TestResourceAdd(unittest.TestCase):
+
+ @classmethod
+ def setUp(self):
+ from tests.functional.purge_users import purge_users
+ purge_users()
+
+ self.john = {
+ 'local': 'john.doe',
+ 'domain': 'example.org'
+ }
+
+ from tests.functional.user_add import user_add
+ user_add("John", "Doe")
+
+ funcs.purge_resources()
+ self.audi = funcs.resource_add("car", "Audi A4")
+ self.passat = funcs.resource_add("car", "VW Passat")
+ self.boxter = funcs.resource_add("car", "Porsche Boxter S")
+ self.cars = funcs.resource_add("collection", "Company Cars", [ self.audi['dn'], self.passat['dn'], self.boxter['dn'] ])
+
+ from tests.functional.synchronize import synchronize_once
+ synchronize_once()
+
+ def test_001_resource_created(self):
+ auth = Auth()
+ auth.connect()
+ resource = auth.find_resource(self.audi['mail'])
+ self.assertEqual(resource, self.audi['dn'])
+
+ collection = auth.find_resource(self.cars['mail'])
+ self.assertEqual(collection, self.cars['dn'])
+
+ def test_002_resource_collection(self):
+ auth = Auth()
+ auth.connect()
+ attrs = auth.get_entry_attributes(None, self.cars['dn'], ['*'])
+ self.assertIn('groupofuniquenames', attrs['objectclass'])
+ self.assertEqual(len(attrs['uniquemember']), 3)