aboutsummaryrefslogtreecommitdiffstats
path: root/archive_folder.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2018-04-21 22:55:05 +0200
committerMatěj Cepl <mcepl@cepl.eu>2018-04-21 23:03:51 +0200
commit75be2c284dc0647765046b55655ecd0dbb64f131 (patch)
treeb1cff04f8f0f9a28225db70f5791b8d413dc0974 /archive_folder.py
parent26daa1452153ba503f8b5b941f1574275346ecfd (diff)
downloadimapArch-75be2c284dc0647765046b55655ecd0dbb64f131.tar.gz
Functioning tests of EmailServer creation with mock.
Diffstat (limited to 'archive_folder.py')
-rwxr-xr-xarchive_folder.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/archive_folder.py b/archive_folder.py
index e321dfe..744fcba 100755
--- a/archive_folder.py
+++ b/archive_folder.py
@@ -189,30 +189,21 @@ class EmailServer(object):
config = self.get_config()
acc_name = serverKey if serverKey is not None \
else config['general']['account']
- if config.has_section(acc_name):
- self.cfg = dict(config.items(acc_name))
- else:
- self.cfg = {
- 'host': 'localhost',
- 'username': 'unknown',
- 'password': 'verysecret'
- }
+ self.cfg = dict(config.items(acc_name))
self.archive_root = archive_root
self.__box = self.__login(**self.cfg)
def __login(self, host='localhost', username=None, password=None, ssl=None):
box = imaplib.IMAP4_SSL(host=host)
- ok, data = box.login(username, password)
+ res = box.login(username, password)
+ ok, data = res
if ok != 'OK':
raise ServerError('Cannot login with credentials %s' %
str((host, username, password,)))
ok, data = box.capability()
- log.debug('data = %s', data)
capas = data[0].decode()
- log.debug('capas = %s', capas)
box.features_present = Capas._make(['MOVE' in capas, 'UIDPLUS' in capas])
- log.debug('features_present = %s', box.features_present)
@staticmethod
@functools.lru_cache()