Skip to content

Commit

Permalink
Ensure schedule creation tests are failing for the good reason
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Nov 6, 2023
1 parent 2c89d6f commit 290c589
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,23 @@ def test_create_schedule_missing_keys(self, client, access_token, key):
"flags": {},
"image": {"name": "openzim/phet", "tag": "latest"},
"monitor": False,
"platform": None,
"resources": {"cpu": 3, "memory": 1024, "disk": 0},
},
"periodicity": "quarterly",
}

del schedule[key]
url = "/schedules/"
response = client.post(
url, json=schedule, headers={"Authorization": access_token}
)
response_data = response.get_json()
print(response_data)
assert response.status_code == 400
assert "error_description" in response_data
assert key in response_data["error_description"]
assert "Missing data for required field." in response_data["error_description"][key]

@pytest.mark.parametrize("key", ["warehouse_path", "flags", "image"])
def test_create_schedule_missing_config_keys(self, client, access_token, key):
Expand All @@ -293,15 +301,24 @@ def test_create_schedule_missing_config_keys(self, client, access_token, key):
"flags": {},
"image": {"name": "openzim/phet", "tag": "latest"},
"monitor": False,
"platform": None,
"resources": {"cpu": 3, "memory": 1024, "disk": 0},
},
"periodicity": "quarterly",
}

del schedule["config"][key]
url = "/schedules/"
response = client.post(
url, json=schedule, headers={"Authorization": access_token}
)
response_data = response.get_json()
print(response_data)
assert response.status_code == 400
assert "error_description" in response_data
assert "config" in response_data["error_description"]
assert key in response_data["error_description"]["config"]
assert "Missing data for required field." in response_data["error_description"]["config"][key]

def test_create_schedule_flags_ko(self, client, access_token):
schedule = {
Expand Down

0 comments on commit 290c589

Please sign in to comment.