Skip to content
Snippets Groups Projects
Commit 72c2043b authored by NolanB's avatar NolanB
Browse files

Add tests

parent 6afc3251
No related branches found
No related tags found
No related merge requests found
Pipeline #79379 passed
......@@ -61,24 +61,26 @@ def test_create_model_version():
@pytest.mark.parametrize(
"model_version_details, status_code",
"content, status_code",
[
(
{
"id": "fake_model_version_id",
"model_id": "fake_model_id",
"hash": "hash",
"archive_hash": "archive_hash",
"size": "size",
"s3_url": "http://hehehe.com",
"s3_put_url": "http://hehehe.com",
"hash": {
"id": "fake_model_version_id",
"model_id": "fake_model_id",
"hash": "hash",
"archive_hash": "archive_hash",
"size": "size",
"s3_url": "http://hehehe.com",
"s3_put_url": "http://hehehe.com",
}
},
400,
),
({"hash": ["A version for this model with this hash already exists."]}, 403),
],
)
def test_retrieve_created_model_version(model_version_details, status_code):
def test_retrieve_created_model_version(content, status_code):
"""There is an existing model version in Created mode, A 400 was raised.
But the model is still returned in error content
"""
......@@ -93,18 +95,18 @@ def test_retrieve_created_model_version(model_version_details, status_code):
id=model_id,
status_code=status_code,
body={"hash": hash, "archive_hash": archive_hash, "size": size},
content={"hash": model_version_details},
content=content,
)
if status_code == 400:
assert (
training.create_model_version(model_id, hash, size, archive_hash)
== model_version_details
== content["hash"]
)
elif status_code == 403:
none_value = None
assert (
training.create_model_version(model_id, hash, size, archive_hash)
== model_version_details
== none_value
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment