Files
dakiny-bot/dakiny_bot/tests/utils/test_get_quarter_cycle.py
T
imcompiling 09958c31ad
build_develop / build (push) Successful in 38s
Save: adding all files to save progress.
I don't exactly remember where I was on this, but I need to move on
and work on other things. Adding all files just to save my work.
2025-07-15 09:12:38 -04:00

32 lines
1.1 KiB
Python

"""Test functions for get_quarter_cycle."""
from unittest.mock import mock_open, patch
from freezegun import freeze_time
from dakiny_bot.dakiny_settings import ChannelIds, DakinySettings, Election, Params, PointSettings, RoleIds
from dakiny_bot.election_utils import get_quarter_cycle
# I only care about term start and term end for this test
q1 = Election(True, "", "", "", "", "q1", "4/30", "2/1", "", "") # noqa: FBT003
q2 = Election(True, "", "", "", "", "q2", "7/31", "5/1", "", "") # noqa: FBT003
q3 = Election(True, "", "", "", "", "q3", "10/31", "8/1", "", "") # noqa: FBT003
q4 = Election(True, "", "", "", "", "q4", "1/31", "11/1", "", "") # noqa: FBT003
# Dummy all the values I don't care about.
settings = DakinySettings(
ChannelIds(1, 1, 1, 1, 1, 1),
[q1, q2, q3, q4],
Params("", "", 1),
PointSettings(1, 1, 1, 1, 1, True, True), # noqa: FBT003
RoleIds(1, 1, 1, 1, 1),
)
@patch("election_utils.get_quarter_cycle.settings", settings)
@patch("builtins.open", new_callable=mock_open)
class TestGetQuarterCycle:
@freeze_time("2025-2-25")
def test_regular_q1(self) -> None:
assert get_quarter_cycle() == 0