Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Modify test for coverage and add page name to its representation
oldPadavan6ad1b08a9aef
diff --git a/saleor/dashboard/menu/utils.py b/saleor/dashboard/menu/utils.pyindex b805531cd3..0f7225fc5b 100644--- a/saleor/dashboard/menu/utils.py+++ b/saleor/dashboard/menu/utils.py@@ -100,8 +100,10 @@ def get_menu_obj_text(obj):elif isinstance(obj, Page) and obj.is_visible and obj.available_on:return pgettext('Menu item page hidden status',- 'Hidden (will become visible on %(available_on_date)s)' % (- {'available_on_date': localize(obj.available_on)}))+ '%(menu_item_name)s is hidden '+ '(will become visible on %(available_on_date)s)' % ({+ 'available_on_date': localize(obj.available_on),+ 'menu_item_name': str(obj)}))return pgettext('Menu item published status','%(menu_item_name)s (Not published)' % {diff --git a/tests/dashboard/test_menu.py b/tests/dashboard/test_menu.pyindex cf08b8f5d9..c5c5560d01 100644--- a/tests/dashboard/test_menu.py+++ b/tests/dashboard/test_menu.py@@ -2,6 +2,8 @@ import jsonfrom unittest import mockimport pytestfrom django.urls import reverse+from django.utils import timezone+from django.utils.formats import localizefrom saleor.dashboard.menu.forms import AssignMenuFormfrom saleor.dashboard.menu.utils import (@@ -258,15 +260,25 @@ def test_view_ajax_reorder_menu_items_with_parent(@pytest.mark.integrationdef test_view_ajax_menu_links(admin_client, collection, category, page):+ collection.is_published = False+ collection.save()+ page.is_visible = True+ page.available_on = timezone.now() + timezone.timedelta(days=1)+ page.save()+ page.refresh_from_db()+collection_repr = {'id': str(collection.pk) + '_' + 'Collection',- 'text': str(collection)}+ 'text': str(collection) + ' (Not published)'}category_repr = {'id': str(category.pk) + '_' + 'Category','text': str(category)}page_repr = {'id': str(page.pk) + '_' + 'Page',- 'text': str(page) + ' (Not published)'}+ 'text': '%(menu_item_name)s is hidden '+ '(will become visible on %(available_on_date)s)' % ({+ 'available_on_date': localize(page.available_on),+ 'menu_item_name': str(page)})}groups = [{'text': 'Collection', 'children': [collection_repr]},{'text': 'Category', 'children': [category_repr]},