Tests download view for permissions

This commit is contained in:
David Larlet 2023-11-14 13:37:02 -05:00
parent 97fa8c2754
commit 30e83a143c
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD

View file

@ -662,3 +662,24 @@ def test_download(client, map, datalayer):
"type": "FeatureCollection",
},
]
@pytest.mark.parametrize("share_status", [Map.PRIVATE, Map.BLOCKED])
def test_download_shared_status_map(client, map, datalayer, share_status):
map.share_status = share_status
map.save()
url = reverse("map_download", args=(map.pk,))
response = client.get(url)
assert response.status_code == 403
def test_download_my_map(client, map, datalayer):
map.share_status = Map.PRIVATE
map.save()
client.login(username=map.owner.username, password="123123")
url = reverse("map_download", args=(map.pk,))
response = client.get(url)
assert response.status_code == 200
# Test response is a json
j = json.loads(response.content.decode())
assert j["type"] == "umap"