diff --git a/program/tests/test_images.py b/program/tests/test_images.py index fad1e974aee1f0bc5857c0b20d7c99ef00c2b5ba..0c5613cf30bbf02fd8caa016db72b33dd694f36d 100644 --- a/program/tests/test_images.py +++ b/program/tests/test_images.py @@ -39,6 +39,27 @@ def test_create_image(image_file, common_api_client1): assert response.status_code == 201 +def test_create_image_with_license(image_file, common_api_client1, public_domain_license): + content_license = { + "credits": "CREDITS", + "is_use_explicitly_granted_by_author": True, + "license_id": public_domain_license.id, + } + + data = {"image": image_file} + data.update({"content_license." + key: value for key, value in content_license.items()}) + + response = common_api_client1.post(url(), data=data) + + assert response.status_code == 201 + assert response.data["content_license"]["credits"] == content_license["credits"] + assert ( + response.data["content_license"]["is_use_explicitly_granted_by_author"] + is content_license["is_use_explicitly_granted_by_author"] + ) + assert response.data["content_license"]["license_id"] == public_domain_license.id + + def test_delete_image(owned_image, common_api_client1): response = common_api_client1.delete(url(owned_image))