-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes #575
- Loading branch information
Showing
4 changed files
with
1,520 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -480,6 +480,31 @@ def mock_imap_amazon_shipped_uk(): | |
yield mock_conn | ||
|
||
|
||
@pytest.fixture() | ||
def mock_imap_amazon_shipped_uk_2(): | ||
"""Mock imap class values.""" | ||
with patch( | ||
"custom_components.mail_and_packages.helpers.imaplib" | ||
) as mock_imap_amazon_shipped: | ||
mock_conn = mock.Mock(spec=imaplib.IMAP4_SSL) | ||
mock_imap_amazon_shipped.IMAP4_SSL.return_value = mock_conn | ||
|
||
mock_conn.login.return_value = ( | ||
"OK", | ||
[b"[email protected] authenticated (Success)"], | ||
) | ||
mock_conn.list.return_value = ( | ||
"OK", | ||
[b'(\\HasNoChildren) "/" "INBOX"'], | ||
) | ||
mock_conn.search.return_value = ("OK", [b"1"]) | ||
f = open("tests/test_emails/amazon_uk_shipped_2.eml", "r") | ||
email_file = f.read() | ||
mock_conn.fetch.return_value = ("OK", [(b"", email_file.encode("utf-8"))]) | ||
mock_conn.select.return_value = ("OK", []) | ||
yield mock_conn | ||
|
||
|
||
@pytest.fixture() | ||
def mock_imap_amazon_shipped_alt(): | ||
"""Mock imap class values.""" | ||
|
Oops, something went wrong.