Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from ninoseki/refactoring-outlookmsgparser
refactor: outlookmsgfile refactoring
- Loading branch information
Showing
7 changed files
with
83 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from io import BytesIO | ||
|
||
from app.services.outlookmsgfile import Message | ||
|
||
|
||
def test_other_msg(other_msg: bytes): | ||
file = BytesIO(other_msg) | ||
message = Message(file) | ||
email = message.to_email() | ||
|
||
assert email["Subject"] == "投递状态通知 (Failure Notice)" | ||
assert email["To"] == "yosipnps@model.com" | ||
|
||
attachments = [attachment for attachment in email.iter_attachments()] | ||
assert len(attachments) == 1 | ||
|
||
|
||
def test_outer_msg(outer_msg: bytes): | ||
file = BytesIO(outer_msg) | ||
message = Message(file) | ||
email = message.to_email() | ||
|
||
assert email["Subject"] == "outer subject" | ||
assert email["To"] == "outer@foo.bar" | ||
|
||
attachments = [attachment for attachment in email.iter_attachments()] | ||
assert len(attachments) == 1 |