feat: add maintenance module for message deletion and related utilities
feat: implement tests for maintenance functions and dashboard interactions feat: add timezone and country tests for thctime module
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import main
|
||||
|
||||
|
||||
def test_main_exits_quickly(monkeypatch):
|
||||
monkeypatch.setattr(main, "send_notification", lambda x: None)
|
||||
monkeypatch.setattr(main, "start_dashboard", lambda: None)
|
||||
monkeypatch.setattr(main.schedule, "run_pending", lambda: (
|
||||
_ for _ in ()).throw(KeyboardInterrupt()))
|
||||
monkeypatch.setattr(main.time, "sleep", lambda s: None)
|
||||
monkeypatch.setenv("DISCORD_WEBHOOK_URL", "http://example.com/webhook")
|
||||
main.WEBHOOK_URL = "http://example.com/webhook"
|
||||
|
||||
main.main()
|
||||
|
||||
|
||||
def test_get_next_scheduled_event():
|
||||
now = main.datetime(2025, 1, 1, 10, 14, 30)
|
||||
nxt = main.get_next_scheduled_event(now)
|
||||
assert nxt["type"] == "reminder"
|
||||
assert nxt["at"].hour == 10 and nxt["at"].minute == 15
|
||||
|
||||
now = main.datetime(2025, 1, 1, 10, 50, 1)
|
||||
nxt = main.get_next_scheduled_event(now)
|
||||
assert nxt["type"] == "reminder"
|
||||
assert nxt["at"].hour == 11 and nxt["at"].minute == 15
|
||||
Reference in New Issue
Block a user