Merge pull request #1410 from umap-project/favicon-tests

Add tests for favicon-related views
This commit is contained in:
David Larlet 2023-11-15 16:24:17 -05:00 committed by GitHub
commit ec1a39c590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View file

@ -364,3 +364,29 @@ def test_user_profile_does_not_allow_to_edit_other_fields(client, map):
user = User.objects.get(pk=map.owner.pk)
assert user.email != new_email
assert user.is_superuser is False
def test_favicon_redirection(client):
response = client.get("/favicon.ico")
assert response.status_code == 302
assert response.url == "/static/umap/favicons/favicon.ico"
def test_webmanifest(client):
response = client.get("/manifest.webmanifest")
assert response.status_code == 200
assert response["content-type"] == "application/json"
assert response.json() == {
"icons": [
{
"sizes": "192x192",
"src": "/static/umap/favicons/icon-192.png",
"type": "image/png",
},
{
"sizes": "512x512",
"src": "/static/umap/favicons/icon-512.png",
"type": "image/png",
},
]
}

View file

@ -422,7 +422,7 @@ def _urls_for_js(urls=None):
def simple_json_response(**kwargs):
return HttpResponse(json.dumps(kwargs))
return HttpResponse(json.dumps(kwargs), content_type="application/json")
# ############## #