import pytest from django.urls import reverse from ....cache.test import assert_invalidates_cache from ....test import assert_contains, assert_has_error_message from ... import THEME_CACHE from ...models import Theme @pytest.fixture def create_link(): return reverse("misago:admin:themes:new") @pytest.fixture def edit_link(theme): return reverse("misago:admin:themes:edit", kwargs={"pk": theme.pk}) def test_theme_creation_form_is_displayed(admin_client, create_link): response = admin_client.get(create_link) assert response.status_code == 200 assert_contains(response, "New theme") def test_theme_creation_form_reads_parent_from_url_and_preselects_it_in_parent_select( admin_client, create_link, theme ): response = admin_client.get("%s?parent=%s" % (create_link, theme.pk)) assert_contains(response, '