diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-07-05 10:17:42 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-07-05 10:17:42 +0200 |
commit | 744018c967b114f389090a9105d9cafac57d818f (patch) | |
tree | 395629fc8ce4d5c9035e5a9c90444165e39039e7 /tests/rm-mail-parser-expected-struct.py | |
parent | aca37b64c841037fce16ebbe63360ed5c9db17c8 (diff) | |
download | aerogramme-744018c967b114f389090a9105d9cafac57d818f.tar.gz aerogramme-744018c967b114f389090a9105d9cafac57d818f.zip |
Add some test emails from mail-parser
Diffstat (limited to 'tests/rm-mail-parser-expected-struct.py')
-rw-r--r-- | tests/rm-mail-parser-expected-struct.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/rm-mail-parser-expected-struct.py b/tests/rm-mail-parser-expected-struct.py new file mode 100644 index 0000000..3dbc56e --- /dev/null +++ b/tests/rm-mail-parser-expected-struct.py @@ -0,0 +1,17 @@ +from os import listdir +from os.path import isfile, join +import sys + +path = sys.argv[1] +onlyfiles = [join(path, f) for f in listdir(path) if isfile(join(path, f)) and len(f) > 4 and f[-4:] == ".txt"] + +for p in onlyfiles: + g = p[:-4] + ".eml" + print(f"{p} -> {g}") + with open(p, 'r+b') as inp: + with open(g, 'w+b') as out: + for line in inp: + if b"EXPECTED STRUCTURE" in line: + break + out.write(line) + |