standardize packaging, tooling, docs, CI, and licensing
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from mail_intake.models import MailIntakeMessage
|
||||
from mail_intake.models import MailIntakeThread
|
||||
from mail_intake.models import MailIntakeMessage, MailIntakeThread
|
||||
|
||||
|
||||
def test_message_is_immutable():
|
||||
@@ -19,7 +18,7 @@ def test_message_is_immutable():
|
||||
|
||||
try:
|
||||
msg.subject = "Changed"
|
||||
assert False, "Message should be immutable"
|
||||
raise AssertionError("Message should be immutable")
|
||||
except Exception:
|
||||
assert True
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import base64
|
||||
|
||||
from mail_intake.parsers import normalize_subject
|
||||
from mail_intake.parsers import parse_headers, extract_sender
|
||||
from mail_intake.parsers import extract_body
|
||||
from mail_intake.parsers import (
|
||||
extract_body,
|
||||
extract_sender,
|
||||
normalize_subject,
|
||||
parse_headers,
|
||||
)
|
||||
|
||||
|
||||
def _b64(text: str) -> str:
|
||||
@@ -13,6 +16,7 @@ def _b64(text: str) -> str:
|
||||
# Subject parsing
|
||||
# --------------------
|
||||
|
||||
|
||||
def test_normalize_subject_strips_common_prefixes():
|
||||
assert normalize_subject("Re: Interview Update") == "Interview Update"
|
||||
assert normalize_subject("Fwd: Re: Offer Letter") == "Offer Letter"
|
||||
@@ -32,6 +36,7 @@ def test_normalize_subject_empty_and_none_safe():
|
||||
# Header parsing
|
||||
# --------------------
|
||||
|
||||
|
||||
def test_parse_headers_lowercases_keys():
|
||||
raw_headers = [
|
||||
{"name": "From", "value": "Alice <alice@example.com>"},
|
||||
@@ -82,6 +87,7 @@ def test_extract_sender_missing_from():
|
||||
# Body parsing
|
||||
# --------------------
|
||||
|
||||
|
||||
def test_extract_body_prefers_text_plain():
|
||||
payload = {
|
||||
"parts": [
|
||||
@@ -116,9 +122,7 @@ def test_extract_body_falls_back_to_html():
|
||||
|
||||
|
||||
def test_extract_body_single_part():
|
||||
payload = {
|
||||
"body": {"data": _b64("Single part body")}
|
||||
}
|
||||
payload = {"body": {"data": _b64("Single part body")}}
|
||||
|
||||
body = extract_body(payload)
|
||||
assert body == "Single part body"
|
||||
|
||||
Reference in New Issue
Block a user