feat: add maintenance module for message deletion and related utilities
Build and Deploy Docker Container / test (push) Successful in 37s
Build and Deploy Docker Container / build-and-deploy (push) Failing after 1m3s

feat: implement tests for maintenance functions and dashboard interactions
feat: add timezone and country tests for thctime module
This commit is contained in:
2026-05-10 12:36:02 +02:00
parent 01d94376d4
commit a4c92470b6
8 changed files with 679 additions and 470 deletions
+47
View File
@@ -0,0 +1,47 @@
import thctime
def test_load_timezones_and_countries():
tzs = thctime.load_timezones()
countries = thctime.load_countries()
assert any(t["zone_name"] == "America/New_York" for t in tzs)
assert any(c["country_code"] == "US" for c in countries)
def test_get_tz_and_country_info():
timezones = [{"zone_name": "A/B", "country_code": "US"}]
countries = [{"country_code": "US", "country_name": "United States"}]
assert thctime.get_tz_info("A/B", timezones)["zone_name"] == "A/B"
assert thctime.get_country_info("US", countries)[
"country_name"] == "United States"
assert thctime.get_tz_info("X/Y", timezones) is None
assert thctime.get_country_info("XX", countries) is None
def test_where_is_it_420(monkeypatch):
monkeypatch.setattr(thctime.pytz, "all_timezones", ["Etc/UTC"])
tzs = [{"zone_name": "Etc/UTC", "country_code": "ZZ"}]
countries = [{"country_code": "ZZ", "country_name": "Nowhere"}]
class FakeDatetime:
@staticmethod
def now(tz):
class Result:
hour = 4
return Result()
monkeypatch.setattr(thctime, "datetime", FakeDatetime)
res = thctime.where_is_it_420(tzs, countries)
assert res == ["Nowhere"]
def test_split_tz_name():
assert thctime.split_tz_name("America/New_York") == ("America", "New_York")
assert thctime.split_tz_name("America/Argentina/Buenos_Aires") == (
"America",
"Argentina/Buenos_Aires",
)
assert thctime.split_tz_name("UTC") == ("UTC", "")