aboutsummaryrefslogtreecommitdiff
path: root/docs/scripts/tests/test_extract_metadata.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-22 23:20:56 -0600
committerCraig Jennings <c@cjennings.net>2026-02-22 23:20:56 -0600
commit3a2445080c880544985f50fb0d916534698cc073 (patch)
tree909f98edbbb940aafb95de02457d4d6f7db3cba4 /docs/scripts/tests/test_extract_metadata.py
parent3595aa8a8122da543676717fb5825044eee99a9d (diff)
downloadarchangel-3a2445080c880544985f50fb0d916534698cc073.tar.gz
archangel-3a2445080c880544985f50fb0d916534698cc073.zip
chore: add docs/ to .gitignore and untrack personal files
docs/ contains session history, personal workflows, and private protocols that shouldn't be in a public repository.
Diffstat (limited to 'docs/scripts/tests/test_extract_metadata.py')
-rw-r--r--docs/scripts/tests/test_extract_metadata.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/docs/scripts/tests/test_extract_metadata.py b/docs/scripts/tests/test_extract_metadata.py
deleted file mode 100644
index d5ee52e..0000000
--- a/docs/scripts/tests/test_extract_metadata.py
+++ /dev/null
@@ -1,65 +0,0 @@
-"""Tests for extract_metadata()."""
-
-import sys
-import os
-
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
-
-from conftest import make_plain_message, add_received_headers
-from email.message import EmailMessage
-
-import importlib.util
-spec = importlib.util.spec_from_file_location(
- "eml_script",
- os.path.join(os.path.dirname(__file__), '..', 'eml-view-and-extract-attachments.py')
-)
-eml_script = importlib.util.module_from_spec(spec)
-spec.loader.exec_module(eml_script)
-
-extract_metadata = eml_script.extract_metadata
-
-
-class TestAllHeadersPresent:
- def test_complete_dict(self):
- msg = make_plain_message(
- from_="Jonathan Smith <jsmith@example.com>",
- to="Craig <craig@example.com>",
- subject="Test Subject",
- date="Thu, 05 Feb 2026 11:36:00 -0600"
- )
- result = extract_metadata(msg)
- assert result['from'] == "Jonathan Smith <jsmith@example.com>"
- assert result['to'] == "Craig <craig@example.com>"
- assert result['subject'] == "Test Subject"
- assert result['date'] == "Thu, 05 Feb 2026 11:36:00 -0600"
- assert 'timing' in result
-
-
-class TestMissingFrom:
- def test_from_is_none(self):
- msg = EmailMessage()
- msg['To'] = 'craig@example.com'
- msg['Subject'] = 'Test'
- msg['Date'] = 'Thu, 05 Feb 2026 11:36:00 -0600'
- msg.set_content("body")
- result = extract_metadata(msg)
- assert result['from'] is None
-
-
-class TestMissingDate:
- def test_date_is_none(self):
- msg = EmailMessage()
- msg['From'] = 'test@example.com'
- msg['To'] = 'craig@example.com'
- msg['Subject'] = 'Test'
- msg.set_content("body")
- result = extract_metadata(msg)
- assert result['date'] is None
-
-
-class TestLongSubject:
- def test_full_subject_returned(self):
- long_subject = "Re: Fw: This is a very long subject line that spans many words and might be folded"
- msg = make_plain_message(subject=long_subject)
- result = extract_metadata(msg)
- assert result['subject'] == long_subject