From 3b8730929727f3aca5441517237e7f84283d6509 Mon Sep 17 00:00:00 2001 From: TheBurchLog <5104941+TheBurchLog@users.noreply.github.com> Date: Fri, 22 Nov 2024 09:51:47 -0500 Subject: [PATCH] Updating Timezone Defaults --- brewtils/models.py | 6 +++--- brewtils/test/fixtures.py | 14 ++++---------- test/models_test.py | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/brewtils/models.py b/brewtils/models.py index 46a11c48..9eb7e257 100644 --- a/brewtils/models.py +++ b/brewtils/models.py @@ -1257,7 +1257,7 @@ def __repr__(self): class DateTrigger(BaseModel): schema = "DateTriggerSchema" - def __init__(self, run_date=None, timezone=None): + def __init__(self, run_date=None, timezone="UTC"): self.run_date = run_date self.timezone = timezone @@ -1291,7 +1291,7 @@ def __init__( seconds=None, start_date=None, end_date=None, - timezone=None, + timezone="UTC", jitter=None, reschedule_on_finish=None, ): @@ -1364,7 +1364,7 @@ def __init__( second=None, start_date=None, end_date=None, - timezone=None, + timezone="UTC", jitter=None, ): self.year = year diff --git a/brewtils/test/fixtures.py b/brewtils/test/fixtures.py index b91a3a15..266d01de 100644 --- a/brewtils/test/fixtures.py +++ b/brewtils/test/fixtures.py @@ -77,12 +77,6 @@ def ts_dt_eastern(): return datetime(2016, 1, 1, tzinfo=ZoneInfo("US/Eastern")) -@pytest.fixture -def ts_2_dt(ts_2_epoch): - """Feb 2, 2017 as a naive datetime.""" - return datetime(2017, 2, 2) - - @pytest.fixture def ts_2_epoch(): """Feb 2, 2017 UTC as epoch milliseconds.""" @@ -814,11 +808,11 @@ def interval_trigger_dict(ts_epoch, ts_2_epoch): @pytest.fixture -def bg_interval_trigger(interval_trigger_dict, ts_dt, ts_2_dt): +def bg_interval_trigger(interval_trigger_dict, ts_dt, ts_2_dt_utc): """An interval trigger as a model.""" dict_copy = copy.deepcopy(interval_trigger_dict) dict_copy["start_date"] = ts_dt - dict_copy["end_date"] = ts_2_dt + dict_copy["end_date"] = ts_2_dt_utc return IntervalTrigger(**dict_copy) @@ -848,11 +842,11 @@ def cron_trigger_dict(ts_epoch, ts_2_epoch): @pytest.fixture -def bg_cron_trigger(cron_trigger_dict, ts_dt, ts_2_dt): +def bg_cron_trigger(cron_trigger_dict, ts_dt, ts_2_dt_utc): """A cron trigger as a model.""" dict_copy = copy.deepcopy(cron_trigger_dict) dict_copy["start_date"] = ts_dt - dict_copy["end_date"] = ts_2_dt + dict_copy["end_date"] = ts_2_dt_utc return CronTrigger(**dict_copy) diff --git a/test/models_test.py b/test/models_test.py index cab6a494..330ba3e9 100644 --- a/test/models_test.py +++ b/test/models_test.py @@ -508,7 +508,7 @@ def test_str(self, bg_event): def test_repr(self, bg_event, bg_request): assert ( repr(bg_event) == "" % bg_request )