aboutsummaryrefslogtreecommitdiff
path: root/tests/instrumentation/rm-mail-parser-expected-struct.py
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-12-27 18:33:06 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-12-27 18:33:06 +0100
commitccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7 (patch)
tree985f9d136a981ec7cc43984c976c60e9295340d5 /tests/instrumentation/rm-mail-parser-expected-struct.py
parent7744625c18aff5990a792bb13a44b60d8c4d4fc5 (diff)
downloadaerogramme-ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7.tar.gz
aerogramme-ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7.zip
add a --dev mode
Diffstat (limited to 'tests/instrumentation/rm-mail-parser-expected-struct.py')
-rw-r--r--tests/instrumentation/rm-mail-parser-expected-struct.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/instrumentation/rm-mail-parser-expected-struct.py b/tests/instrumentation/rm-mail-parser-expected-struct.py
new file mode 100644
index 0000000..3dbc56e
--- /dev/null
+++ b/tests/instrumentation/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)
+