Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add test for diff coverage

oldPadavan09450fc07cf9
diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py
index 4cfdf13d1e..0160332726 100644
--- a/tests/test_templatetags.py
+++ b/tests/test_templatetags.py
@@ -1,7 +1,8 @@
-import json
-
from django.urls import reverse
+
from saleor.core.templatetags.shop import get_sort_by_url, menu
+from saleor.core.templatetags.status import (
+ LABEL_SUCCESS, render_page_availability)
def test_sort_by_url_ascending(admin_client, category):
@@ -30,3 +31,14 @@ def test_menu(menu_with_items):
result = menu(menu_with_items)
assert result['menu_items'] == menu_with_items.json_content
+
+
+def test_render_page_availability(page):
+ page_ctx = render_page_availability(page)
+ assert page_ctx == {'page': page, 'is_published': False}
+
+ page.is_visible = True
+ page.save()
+ page_ctx = render_page_availability(page)
+ assert page_ctx == {
+ 'page': page, 'is_published': True, 'label_cls': LABEL_SUCCESS}