11import asyncio
22import email
3- from datetime import datetime
3+ from datetime import datetime , timezone
44from email .mime .text import MIMEText
55from unittest .mock import AsyncMock , MagicMock , patch
66
@@ -104,12 +104,12 @@ def test_build_search_criteria(self):
104104 assert criteria == ["ALL" ]
105105
106106 # Test with before date
107- before_date = datetime (2023 , 1 , 1 )
107+ before_date = datetime (2023 , 1 , 1 , tzinfo = timezone . utc )
108108 criteria = EmailClient ._build_search_criteria (before = before_date )
109109 assert criteria == ["BEFORE" , "01-JAN-2023" ]
110110
111111 # Test with since date
112- since_date = datetime (2023 , 1 , 1 )
112+ since_date = datetime (2023 , 1 , 1 , tzinfo = timezone . utc )
113113 criteria = EmailClient ._build_search_criteria (since = since_date )
114114 assert criteria == ["SINCE" , "01-JAN-2023" ]
115115
@@ -135,7 +135,7 @@ def test_build_search_criteria(self):
135135
136136 # Test with multiple criteria
137137 criteria = EmailClient ._build_search_criteria (
138- subject = "Test" , from_address = "test@example.com" , since = datetime (2023 , 1 , 1 )
138+ subject = "Test" , from_address = "test@example.com" , since = datetime (2023 , 1 , 1 , tzinfo = timezone . utc )
139139 )
140140 assert criteria == ["SINCE" , "01-JAN-2023" , "SUBJECT" , "Test" , "FROM" , "test@example.com" ]
141141
@@ -172,7 +172,7 @@ async def test_get_emails_stream(self, email_client):
172172 "subject" : "Test Subject" ,
173173 "from" : "sender@example.com" ,
174174 "body" : "Test Body" ,
175- "date" : datetime .now (),
175+ "date" : datetime .now (timezone . utc ),
176176 "attachments" : [],
177177 }
178178
0 commit comments