Skip to content

Commit

Permalink
test: improved test_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 19, 2023
1 parent 520c77c commit 60269e7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import logging
import random
from datetime import datetime, timedelta, timezone
Expand Down Expand Up @@ -272,6 +273,19 @@ def test_midnight_heartbeats(aw_client, bucket):

def test_settings(aw_client):
aw_client.set_setting("test", "test")
aw_client.set_setting("list", json.dumps([1, 2, 3]))
aw_client.set_setting("dict", json.dumps({"a": 1, "b": 2}))

# check set
assert aw_client.get_setting("test") == "test"
assert json.loads(aw_client.get_setting("list")) == [1, 2, 3]
assert json.loads(aw_client.get_setting("dict")) == {"a": 1, "b": 2}

# check unset
assert aw_client.get_setting("test2") is None
assert aw_client.get_setting() == {"test": "test"}

# check get all
settings = aw_client.get_setting()
assert settings["test"] == "test"
assert json.loads(settings["list"]) == [1, 2, 3]
assert json.loads(settings["dict"]) == {"a": 1, "b": 2}

0 comments on commit 60269e7

Please sign in to comment.