Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhozic committed Apr 26, 2023
1 parent 83581f8 commit d9c72a7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions testing/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@pytest.mark.asyncio
async def test_logging_json(channels, guilds, accounts):
"Test if json logging works"
account = accounts[0]
account: daf.ACCOUNT = accounts[0]
dc_guild, _ = guilds
text_channels, _ = channels
try:
Expand All @@ -35,7 +35,7 @@ def check_json_results(message_context):
.joinpath("{:02d}".format(timestruct.month))
.joinpath("{:02d}".format(timestruct.day)))

logging_output.mkdir(parents=True,exist_ok=True)
logging_output.mkdir(parents=True, exist_ok=True)
logging_output = logging_output.joinpath("".join(char if char not in C_FILE_NAME_FORBIDDEN_CHAR
else "#" for char in guild_context["name"]) + ".json")
# Check results
Expand All @@ -44,14 +44,14 @@ def check_json_results(message_context):
# Check guild data
for k, v in guild_context.items():
assert result_json[k] == v, "Resulting data does not match the guild_context"

# Check message data
message_history = result_json["message_history"]
message_history = message_history[0] # Get only last send data
str_acc = str(account.client.user.id)
message_history = result_json["authors"][str_acc]["messages"]
message_history = message_history[0] # Get only last send data
message_history.pop("index")
message_history.pop("timestamp")
assert message_history == message_context # Should be exact match

assert message_history == message_context # Should be exact match

data = [
"Hello World",
Expand Down

0 comments on commit d9c72a7

Please sign in to comment.