summaryrefslogtreecommitdiffstats
path: root/tests/functional/test_wap_client
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-05-04 15:53:48 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-04 15:53:48 +0200
commitc204eaaa2c9a006432fe00489a352833143db01d (patch)
tree18860f2e335b9a98d34f404d5c4b81d22f2ce222 /tests/functional/test_wap_client
parent4a24e0cc403321713ee1201ade9d36956da1c060 (diff)
downloadpykolab-c204eaaa2c9a006432fe00489a352833143db01d.tar.gz
CS fixes according to PEP8 (ignored mostly line-length errors only)
Summary: . Reviewers: #pykolab_developers Differential Revision: https://git.kolab.org/D134
Diffstat (limited to 'tests/functional/test_wap_client')
-rw-r--r--tests/functional/test_wap_client/__init__.py1
-rw-r--r--tests/functional/test_wap_client/test_001_connect.py15
-rw-r--r--tests/functional/test_wap_client/test_002_user_add.py12
-rw-r--r--tests/functional/test_wap_client/test_003_user_add_fr_FR.py4
-rw-r--r--tests/functional/test_wap_client/test_004_user_add_es_ES.py4
-rw-r--r--tests/functional/test_wap_client/test_005_user_add_de_CH.py3
-rw-r--r--tests/functional/test_wap_client/test_006_form_value_select_options.py6
-rw-r--r--tests/functional/test_wap_client/test_007_policy_uid.py3
-rw-r--r--tests/functional/test_wap_client/test_008_resource_add.py3
9 files changed, 23 insertions, 28 deletions
diff --git a/tests/functional/test_wap_client/__init__.py b/tests/functional/test_wap_client/__init__.py
index d7bf27f..d6cdb57 100644
--- a/tests/functional/test_wap_client/__init__.py
+++ b/tests/functional/test_wap_client/__init__.py
@@ -1,5 +1,6 @@
import pykolab
+
def setup_package():
conf = pykolab.getConf()
conf.finalize_conf(fatal=False)
diff --git a/tests/functional/test_wap_client/test_001_connect.py b/tests/functional/test_wap_client/test_001_connect.py
index aa0c069..783d996 100644
--- a/tests/functional/test_wap_client/test_001_connect.py
+++ b/tests/functional/test_wap_client/test_001_connect.py
@@ -3,6 +3,7 @@ import unittest
import pykolab
from pykolab import wap_client
+
class TestConnect(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -18,23 +19,23 @@ class TestConnect(unittest.TestCase):
def test_002_response_ok(self):
result = wap_client.request_raw('POST', 'domains.list')
- self.assertTrue(result.has_key('status'))
- self.assertTrue(result.has_key('result'))
+ self.assertTrue('status' in result)
+ self.assertTrue('result' in result)
self.assertEqual(result['status'], "OK")
def test_003_response_fail(self):
result = wap_client.request_raw('POST', 'service.method')
- self.assertTrue(result.has_key('status'))
- self.assertTrue(result.has_key('reason'))
- self.assertTrue(result.has_key('code'))
+ self.assertTrue('status' in result)
+ self.assertTrue('reason' in result)
+ self.assertTrue('code' in result)
self.assertEqual(result['status'], "ERROR")
self.assertEqual(result['reason'], "Unknown service")
self.assertEqual(result['code'], 400)
def test_004_domains_list(self):
result = wap_client.domains_list()
- self.assertTrue(result.has_key('count'))
- self.assertTrue(result.has_key('list'))
+ self.assertTrue('count' in result)
+ self.assertTrue('list' in result)
self.assertEqual(result['count'], len(result['list']))
def test_005_get_domain(self):
diff --git a/tests/functional/test_wap_client/test_002_user_add.py b/tests/functional/test_wap_client/test_002_user_add.py
index 96c3de1..771e700 100644
--- a/tests/functional/test_wap_client/test_002_user_add.py
+++ b/tests/functional/test_wap_client/test_002_user_add.py
@@ -8,6 +8,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAdd(unittest.TestCase):
@classmethod
@@ -31,7 +32,6 @@ class TestUserAdd(unittest.TestCase):
purge_users()
def test_001_inbox_created(self):
-
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -67,14 +67,12 @@ class TestUserAdd(unittest.TestCase):
metadata = imap.get_metadata(folder)
folder_name = '/'.join(folder.split('/')[2:]).split('@')[0]
- if ac_folders.has_key(folder_name):
- if ac_folders[folder_name].has_key('annotations'):
- for _annotation in ac_folders[folder_name]['annotations'].keys():
+ if folder_name in ac_folders:
+ if 'annotations' in ac_folders[folder_name]:
+ for _annotation in ac_folders[folder_name]['annotations']:
if _annotation.startswith('/private/'):
continue
_annotation_value = ac_folders[folder_name]['annotations'][_annotation]
- self.assertTrue(metadata[metadata.keys().pop()].has_key(_annotation))
+ self.assertTrue(_annotation in metadata[metadata.keys().pop()])
self.assertEqual(_annotation_value, metadata[metadata.keys().pop()][_annotation])
-
-
diff --git a/tests/functional/test_wap_client/test_003_user_add_fr_FR.py b/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
index b9ef510..72cf84b 100644
--- a/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
+++ b/tests/functional/test_wap_client/test_003_user_add_fr_FR.py
@@ -10,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAddFrFR(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -32,7 +33,6 @@ class TestUserAddFrFR(unittest.TestCase):
purge_users()
def test_001_inbox_created(self):
-
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -54,5 +54,3 @@ class TestUserAddFrFR(unittest.TestCase):
self.assertEqual(result['mail'], 'etienne-nicolas.mehul@example.org')
self.assertEqual(sorted(result['alias']), ['e.mehul@example.org', 'mehul@example.org'])
-
-
diff --git a/tests/functional/test_wap_client/test_004_user_add_es_ES.py b/tests/functional/test_wap_client/test_004_user_add_es_ES.py
index a681a2d..7fc5d83 100644
--- a/tests/functional/test_wap_client/test_004_user_add_es_ES.py
+++ b/tests/functional/test_wap_client/test_004_user_add_es_ES.py
@@ -10,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAddEsES(unittest.TestCase):
@classmethod
@@ -33,7 +34,6 @@ class TestUserAddEsES(unittest.TestCase):
purge_users()
def test_001_inbox_created(self):
-
time.sleep(2)
imap = IMAP()
imap.connect()
@@ -54,5 +54,3 @@ class TestUserAddEsES(unittest.TestCase):
self.assertEqual(result['mail'], 'alvaro.fuentes@example.org')
self.assertEqual(sorted(result['alias']), ['a.fuentes@example.org', 'fuentes@example.org'])
-
-
diff --git a/tests/functional/test_wap_client/test_005_user_add_de_CH.py b/tests/functional/test_wap_client/test_005_user_add_de_CH.py
index dd38383..c2d22c6 100644
--- a/tests/functional/test_wap_client/test_005_user_add_de_CH.py
+++ b/tests/functional/test_wap_client/test_005_user_add_de_CH.py
@@ -10,6 +10,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestUserAddDeCH(unittest.TestCase):
@classmethod
def setup_class(self, *args, **kw):
@@ -53,5 +54,3 @@ class TestUserAddDeCH(unittest.TestCase):
self.assertEqual(result['mail'], 'thomas.bruederli@example.org')
self.assertEqual(sorted(result['alias']), ['bruederli@example.org', 't.bruederli@example.org'])
-
-
diff --git a/tests/functional/test_wap_client/test_006_form_value_select_options.py b/tests/functional/test_wap_client/test_006_form_value_select_options.py
index 92b4992..0f2bbdd 100644
--- a/tests/functional/test_wap_client/test_006_form_value_select_options.py
+++ b/tests/functional/test_wap_client/test_006_form_value_select_options.py
@@ -6,6 +6,7 @@ from pykolab import wap_client
conf = pykolab.getConf()
+
class TestFormValueListOptions(unittest.TestCase):
def test_001_list_options_user_preferredlanguage(self):
@@ -24,8 +25,7 @@ class TestFormValueListOptions(unittest.TestCase):
'preferredlanguage'
)
- self.assertTrue(attribute_values['preferredlanguage'].has_key('default'))
- self.assertTrue(attribute_values['preferredlanguage'].has_key('list'))
+ self.assertTrue('default' in attribute_values['preferredlanguage'])
+ self.assertTrue('list' in attribute_values['preferredlanguage'])
self.assertTrue(len(attribute_values['preferredlanguage']['list']) > 1)
self.assertTrue(attribute_values['preferredlanguage']['default'] in attribute_values['preferredlanguage']['list'])
-
diff --git a/tests/functional/test_wap_client/test_007_policy_uid.py b/tests/functional/test_wap_client/test_007_policy_uid.py
index 534ebda..a10eeb9 100644
--- a/tests/functional/test_wap_client/test_007_policy_uid.py
+++ b/tests/functional/test_wap_client/test_007_policy_uid.py
@@ -9,6 +9,7 @@ from pykolab.imap import IMAP
conf = pykolab.getConf()
+
class TestPolicyUid(unittest.TestCase):
def remove_option(self, section, option):
@@ -172,5 +173,3 @@ class TestPolicyUid(unittest.TestCase):
from tests.functional.purge_users import purge_users
purge_users()
-
-
diff --git a/tests/functional/test_wap_client/test_008_resource_add.py b/tests/functional/test_wap_client/test_008_resource_add.py
index 5647d0c..f4b4c20 100644
--- a/tests/functional/test_wap_client/test_008_resource_add.py
+++ b/tests/functional/test_wap_client/test_008_resource_add.py
@@ -10,6 +10,7 @@ import tests.functional.resource_func as funcs
conf = pykolab.getConf()
+
class TestResourceAdd(unittest.TestCase):
@classmethod
@@ -29,7 +30,7 @@ class TestResourceAdd(unittest.TestCase):
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'] ])
+ 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()