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.
This commit is contained in:
@@ -1 +1,7 @@
|
||||
"""Empty init file for dakiny_bot module."""
|
||||
|
||||
from dakiny_bot.dakiny_settings import CONFIG_LOCATION, DakinySettings, settings
|
||||
|
||||
if settings is None:
|
||||
tmp = DakinySettings.from_yaml_file(CONFIG_LOCATION)
|
||||
settings = tmp[0] if isinstance(tmp, list) else tmp
|
||||
|
||||
@@ -83,5 +83,4 @@ class DakinySettings(YAMLWizard):
|
||||
self.to_yaml_file(CONFIG_LOCATION)
|
||||
|
||||
|
||||
tmp = DakinySettings.from_yaml_file(CONFIG_LOCATION)
|
||||
settings: DakinySettings = tmp[0] if isinstance(tmp, list) else tmp
|
||||
settings: DakinySettings | None = None
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import calendar
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from .dakiny_settings import settings
|
||||
from dakiny_bot.dakiny_settings import settings
|
||||
|
||||
|
||||
def get_datetime(month_day: str) -> datetime:
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user