Skip to content

Commit

Permalink
Merge pull request #91 from prodigyfinance/feature/fix-moto-datetime-…
Browse files Browse the repository at this point in the history
…update

Fix test HTTPHeaders returns to include date return
  • Loading branch information
KyleHarrison committed Jul 12, 2023
2 parents 2059c53 + d87a858 commit 5ab5286
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/cli_commands/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_help(self, cli_helper):
def test_list_empty(self, cli_helper):
cli_helper.invoke(["model", "list"], output_jsonl=[])

def test_create_and_list(self, cli_helper):
def test_create_and_list(self, cli_helper, fake_utcnow):
cfg = self.cfg()
model_output = json.loads(
cli_helper.invoke(["model", "create", "mdl-0-1-12"], cfg=cfg)
Expand All @@ -39,7 +39,10 @@ def test_create_and_list(self, cli_helper):
),
"ResponseMetadata": {
"HTTPStatusCode": 200,
"HTTPHeaders": {"server": "amazon.com"},
"HTTPHeaders": {
"server": "amazon.com",
"date": "Thu, 31 Jan 2019 12:00:02 GMT",
},
"RetryAttempts": 0,
},
}
Expand All @@ -63,7 +66,7 @@ def test_create_and_describe(self, cli_helper):
describe_output["ExecutionRoleArn"] == "arn:aws:iam::12345:role/role-name"
)

def test_create_and_delete(self, cli_helper):
def test_create_and_delete(self, cli_helper, fake_utcnow):
cfg = self.cfg()
cli_helper.invoke(["model", "create", "mdl-0-1-12"], cfg=cfg)
delete_output = json.loads(
Expand All @@ -72,7 +75,10 @@ def test_create_and_delete(self, cli_helper):
assert delete_output == {
"ResponseMetadata": {
"HTTPStatusCode": 200,
"HTTPHeaders": {"server": "amazon.com"},
"HTTPHeaders": {
"server": "amazon.com",
"date": "Thu, 31 Jan 2019 12:00:02 GMT",
},
"RetryAttempts": 0,
}
}
4 changes: 4 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class fake_datetime(datetime.datetime):
def utcnow(cls):
return utcnow

@classmethod
def now(cls, **kwargs):
return datetime.datetime(2019, 1, 31, 12, 0, 2)

monkeypatch.setattr(datetime, "datetime", fake_datetime)
return utcnow

Expand Down

0 comments on commit 5ab5286

Please sign in to comment.