!fixup tests
This commit is contained in:
parent
7e75193adb
commit
859fbc5768
|
@ -1,4 +1,4 @@
|
||||||
import json
|
from unittest import mock
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
|
@ -38,20 +38,21 @@ def test_admin_settings_correct_permission(db, logged_in_api_client, preferences
|
||||||
assert len(response.data) == len(preferences.all())
|
assert len(response.data) == len(preferences.all())
|
||||||
|
|
||||||
|
|
||||||
def test_manifest_endpoint(api_client, mocker, preferences, tmp_path, settings):
|
def test_manifest_endpoint(api_client, preferences):
|
||||||
settings.FUNKWHALE_SPA_HTML_ROOT = str(tmp_path / "index.html")
|
with mock.patch(
|
||||||
preferences["instance__name"] = "Test pod"
|
"funkwhale_api.instance.views.PWA_MANIFEST",
|
||||||
preferences["instance__short_description"] = "Test description"
|
{"lang": "unchanged"},
|
||||||
base_payload = {}
|
):
|
||||||
manifest = tmp_path / "manifest.json"
|
preferences["instance__name"] = "Test pod"
|
||||||
expected = {
|
preferences["instance__short_description"] = "Test description"
|
||||||
"name": "Test pod",
|
expected = {
|
||||||
"short_name": "Test pod",
|
"lang": "unchanged",
|
||||||
"description": "Test description",
|
"name": "Test pod",
|
||||||
}
|
"short_name": "Test pod",
|
||||||
manifest.write_bytes(json.dumps(base_payload).encode())
|
"description": "Test description",
|
||||||
|
}
|
||||||
|
|
||||||
url = reverse("api:v1:instance:spa-manifest")
|
url = reverse("api:v1:instance:spa-manifest")
|
||||||
response = api_client.get(url)
|
response = api_client.get(url)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.data == expected
|
assert response.data == expected
|
||||||
|
|
Loading…
Reference in New Issue