summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/test-012-wallace_invitationpolicy.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/unit/test-012-wallace_invitationpolicy.py b/tests/unit/test-012-wallace_invitationpolicy.py
index 189f3c6..8250b89 100644
--- a/tests/unit/test-012-wallace_invitationpolicy.py
+++ b/tests/unit/test-012-wallace_invitationpolicy.py
@@ -14,7 +14,6 @@ from twisted.trial import unittest
from pykolab.auth.ldap import LDAP
from pykolab.constants import *
-
# define some iTip MIME messages
itip_multipart = """MIME-Version: 1.0
@@ -79,6 +78,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.patch(pykolab.auth.Auth, "disconnect", self._mock_nop)
self.patch(pykolab.auth.Auth, "find_user_dn", self._mock_find_user_dn)
self.patch(pykolab.auth.Auth, "get_entry_attributes", self._mock_get_entry_attributes)
+ self.patch(pykolab.auth.Auth, "list_domains", self._mock_list_domains)
# intercept calls to smtplib.SMTP.sendmail()
import smtplib
@@ -96,6 +96,9 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
(_, uid) = entry.split(',')[0].split('=')
return { 'cn': uid, 'mail': uid + "@example.org", '_attrib': attributes }
+ def _mock_list_domains(self):
+ return {'example.org': 'example.org'}
+
def _mock_nop(self, domain=None):
pass
@@ -115,8 +118,7 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
def test_002_user_dn_from_email_address(self):
res = MIP.user_dn_from_email_address("doe@example.org")
- # assert call to (patched) pykolab.auth.Auth.find_resource()
- self.assertEqual("uid=doe,ou=People,dc=example,dc=org", res);
+ self.assertEqual("uid=doe,ou=People,dc=example,dc=org", res)
def test_003_get_matching_invitation_policy(self):
user = { 'kolabinvitationpolicy': [
@@ -135,19 +137,19 @@ class TestWallaceInvitationpolicy(unittest.TestCase):
self.assertEqual(MIP.get_matching_invitation_policies(user, 'maya.foo@example.org', MIP.COND_TYPE_ALL), [MIP.ACT_SAVE_TO_FOLDER])
self.assertEqual(MIP.get_matching_invitation_policies(user, 'd@somedomain.net', MIP.COND_TYPE_ALL), [MIP.ACT_MANUAL])
- def test_004_write_locks(self):
- user = { 'cn': 'John Doe', 'mail': "doe@example.org" }
-
- lock_key = MIP.get_lock_key(user, '1234567890-abcdef')
- lock_file = os.path.join(MIP.mybasepath, 'locks', lock_key + '.lock')
- MIP.set_write_lock(lock_key)
-
- time.sleep(1)
- self.assertTrue(os.path.isfile(lock_file))
- self.assertFalse(MIP.set_write_lock(lock_key, False))
-
- MIP.remove_write_lock(lock_key)
- self.assertFalse(os.path.isfile(lock_file))
+# def test_004_write_locks(self):
+# user = { 'cn': 'John Doe', 'mail': "doe@example.org" }
+#
+# lock_key = MIP.get_lock_key(user, '1234567890-abcdef')
+# lock_file = os.path.join(MIP.mybasepath, 'locks', lock_key + '.lock')
+# MIP.set_write_lock(lock_key)
+#
+# time.sleep(1)
+# self.assertTrue(os.path.isfile(lock_file))
+# self.assertFalse(MIP.set_write_lock(lock_key, False))
+#
+# MIP.remove_write_lock(lock_key)
+# self.assertFalse(os.path.isfile(lock_file))
def test_005_is_auto_reply(self):
all_manual = [ 'ACT_MANUAL' ]