Skip to content

Commit

Permalink
Updating Timezone Defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Nov 22, 2024
1 parent 35c309a commit 3b87309
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 3 additions & 3 deletions brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -1291,7 +1291,7 @@ def __init__(
seconds=None,
start_date=None,
end_date=None,
timezone=None,
timezone="UTC",
jitter=None,
reschedule_on_finish=None,
):
Expand Down Expand Up @@ -1364,7 +1364,7 @@ def __init__(
second=None,
start_date=None,
end_date=None,
timezone=None,
timezone="UTC",
jitter=None,
):
self.year = year
Expand Down
14 changes: 4 additions & 10 deletions brewtils/test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion test/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def test_str(self, bg_event):
def test_repr(self, bg_event, bg_request):
assert (
repr(bg_event) == "<Event: namespace=ns, garden=beer, "
"name=REQUEST_CREATED, timestamp=2016-01-01 00:00:00, error=False, "
"name=REQUEST_CREATED, timestamp=2016-01-01 00:00:00+00:00, error=False, "
"error_message=None, metadata={'extra': 'info'}, payload_type=Request, "
"payload=%r>" % bg_request
)
Expand Down

0 comments on commit 3b87309

Please sign in to comment.