test: handle literal string

Tuple are used for literal strings (see RFC3501 Section 4.3).

Signed-off-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Pierre-Louis Bonicoli 2015-03-23 17:43:55 +01:00 committed by Nicolas Sebrecht
parent 4a5f32febd
commit ecc2af9f99
1 changed files with 10 additions and 6 deletions

View File

@ -148,12 +148,16 @@ class OLITestLib():
assert res_t == 'OK'
dirs = []
for d in data:
m = re.search(br'''
(" # starting quote
([^"]|\\")* # a non-quote or a backslashded quote
")$ # ending quote
''', d, flags=re.VERBOSE)
folder = bytearray(m.group(1))
if isinstance(d, tuple):
# literal (unquoted)
folder = b'"%s"' % d[1].replace('"', '\\"')
else:
m = re.search(br'''
(" # starting quote
([^"]|\\")* # a non-quote or a backslashded quote
")$ # ending quote
''', d, flags=re.VERBOSE)
folder = bytearray(m.group(1))
#folder = folder.replace(br'\"', b'"') # remove quoting
dirs.append(folder)
# 2) filter out those not starting with INBOX.OLItest and del...