Skip to content

Commit

Permalink
#358 - Add status_updated_at field to Request model (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Ross authored Nov 16, 2021
1 parent 5b05669 commit 7154e28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ def __init__(
metadata=None,
hidden=None,
updated_at=None,
status_updated_at=None,
has_parent=None,
requester=None,
):
Expand All @@ -658,6 +659,7 @@ def __init__(
self.hidden = hidden
self.created_at = created_at
self.updated_at = updated_at
self.status_updated_at = status_updated_at
self.error_class = error_class
self.has_parent = has_parent
self.requester = requester
Expand Down
3 changes: 3 additions & 0 deletions brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ class RequestSchema(RequestTemplateSchema):
error_class = fields.Str(allow_none=True)
created_at = DateTime(allow_none=True, format="epoch", example="1500065932000")
updated_at = DateTime(allow_none=True, format="epoch", example="1500065932000")
status_updated_at = DateTime(
allow_none=True, format="epoch", example="1500065932000"
)
has_parent = fields.Bool(allow_none=True)
requester = fields.String(allow_none=True)

Expand Down
6 changes: 6 additions & 0 deletions brewtils/test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def child_request_dict(ts_epoch):
"command_type": "ACTION",
"created_at": ts_epoch,
"updated_at": ts_epoch,
"status_updated_at": ts_epoch,
"error_class": None,
"metadata": {"child": "stuff"},
"has_parent": True,
Expand All @@ -303,6 +304,7 @@ def child_request(child_request_dict, ts_dt):
dict_copy = copy.deepcopy(child_request_dict)
dict_copy["created_at"] = ts_dt
dict_copy["updated_at"] = ts_dt
dict_copy["status_updated_at"] = ts_dt
return Request(**dict_copy)


Expand All @@ -326,6 +328,7 @@ def parent_request_dict(ts_epoch):
"created_at": ts_epoch,
"hidden": False,
"updated_at": ts_epoch,
"status_updated_at": ts_epoch,
"error_class": None,
"metadata": {"parent": "stuff"},
"has_parent": False,
Expand All @@ -339,6 +342,7 @@ def parent_request(parent_request_dict, ts_dt):
dict_copy = copy.deepcopy(parent_request_dict)
dict_copy["created_at"] = ts_dt
dict_copy["updated_at"] = ts_dt
dict_copy["status_updated_at"] = ts_dt
return Request(**dict_copy)


Expand Down Expand Up @@ -386,6 +390,7 @@ def request_dict(parent_request_dict, child_request_dict, ts_epoch):
"command_type": "ACTION",
"created_at": ts_epoch,
"updated_at": ts_epoch,
"status_updated_at": ts_epoch,
"error_class": "ValueError",
"metadata": {"request": "stuff"},
"has_parent": True,
Expand All @@ -401,6 +406,7 @@ def bg_request(request_dict, parent_request, child_request, ts_dt):
dict_copy["children"] = [child_request]
dict_copy["created_at"] = ts_dt
dict_copy["updated_at"] = ts_dt
dict_copy["status_updated_at"] = ts_dt
return Request(**dict_copy)


Expand Down

0 comments on commit 7154e28

Please sign in to comment.