format
This commit is contained in:
parent
e8013f8e0c
commit
c9cbaeb460
|
@ -1371,7 +1371,7 @@ def get_queue_id(msg: Message) -> Optional[str]:
|
|||
"""Get the Postfix queue-id from a message"""
|
||||
header_values = msg.get_all(headers.RSPAM_QUEUE_ID)
|
||||
if header_values:
|
||||
#Get last in case somebody tries to inject a header
|
||||
# Get last in case somebody tries to inject a header
|
||||
return header_values[-1]
|
||||
|
||||
received_header = str(msg[headers.RECEIVED])
|
||||
|
|
|
@ -65,10 +65,10 @@ def test_is_automatic_out_of_office():
|
|||
msg[headers.AUTO_SUBMITTED] = "auto-generated"
|
||||
assert is_automatic_out_of_office(msg)
|
||||
|
||||
|
||||
def test_process_spoofed():
|
||||
msg = load_eml_file("gmail_spoof.eml")
|
||||
breakpoint()
|
||||
a = msg['a']
|
||||
b=1
|
||||
c=2
|
||||
|
||||
a = msg["a"]
|
||||
b = 1
|
||||
c = 2
|
||||
|
|
|
@ -747,10 +747,12 @@ def test_get_queue_id():
|
|||
|
||||
assert get_queue_id(msg) == "4FxQmw1DXdz2vK2"
|
||||
|
||||
|
||||
def test_get_queue_id_from_double_header():
|
||||
msg = load_eml_file("double_queue_id_header.eml")
|
||||
assert get_queue_id(msg) == "6D8C13F069"
|
||||
|
||||
|
||||
def test_should_ignore_bounce(flask_client):
|
||||
assert not should_ignore_bounce("not-exist")
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ def pretty(d):
|
|||
|
||||
|
||||
def load_eml_file(filename: str) -> EmailMessage:
|
||||
emails_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),"example_emls")
|
||||
emails_dir = os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)), "example_emls"
|
||||
)
|
||||
fullpath = os.path.join(emails_dir, filename)
|
||||
return email.message_from_file(open(fullpath))
|
||||
|
|
Loading…
Reference in New Issue