Use aware objects when storing and reading UTC timestamps (#4017)

* Use aware objects instead of naive ones

* Use aware objects when storing and reading UTC timestamps

* Remove unneeded parentheses

* Fixed naive and aware objects unable to be compared here

* Address feedback

* Fix the newly added `modlog.create_case()` calls

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
DevilXD
2020-08-12 10:46:32 +02:00
committed by GitHub
parent 73a34eacd6
commit 6e63ed4e60
10 changed files with 63 additions and 59 deletions

View File

@@ -12,7 +12,7 @@ async def test_modlog_register_casetype(mod):
@pytest.mark.asyncio
async def test_modlog_case_create(mod, ctx, member_factory):
from datetime import datetime as dt
from datetime import datetime, timezone
# Run casetype register test to register casetype in this test too
await test_modlog_register_casetype(mod)
@@ -23,7 +23,7 @@ async def test_modlog_case_create(mod, ctx, member_factory):
case_type = "ban"
moderator = ctx.author
reason = "Test 12345"
created_at = dt.utcnow()
created_at = datetime.now(timezone.utc)
case = await mod.create_case(bot, guild, created_at, case_type, usr, moderator, reason)
assert case is not None
assert case.user == usr