Skip to content

Commit

Permalink
Added test for get_email_list
Browse files Browse the repository at this point in the history
  • Loading branch information
fexfl committed Mar 3, 2025
1 parent 79dea5a commit b0872c5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions mailcom/test/test_inout.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,33 @@ def test_write_csv(get_instant, tmp_path):
assert rows[1]["date"] == "2024-04-18T15:13:56+00:00"
assert rows[1]["attachment"] == "0"
assert rows[1]["attachement type"] == "[]"


def test_get_email_list(get_instant):
# Create some test email data
email_data = [
{
"content": "Content of test email 1",
"date": "2024-04-17T15:13:56+00:00",
"attachment": 1,
"attachement type": ["jpg"],
},
{
"content": "Content of test email 2",
"date": "2024-04-18T15:13:56+00:00",
"attachment": 0,
"attachement type": [],
},
]
get_instant.email_list = email_data

# Get the email list iterator
email_list_iter = get_instant.get_email_list()

# Verify the contents of the email list
assert next(email_list_iter) == email_data[0]
assert next(email_list_iter) == email_data[1]

# Verify that the iterator is exhausted
with pytest.raises(StopIteration):
next(email_list_iter)

0 comments on commit b0872c5

Please sign in to comment.