Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix tests
akjanik57d9ae4db009
diff --git a/saleor/graphql/menu/mutations.py b/saleor/graphql/menu/mutations.pyindex 9100a1dce9..49f8f1c19e 100644--- a/saleor/graphql/menu/mutations.py+++ b/saleor/graphql/menu/mutations.py@@ -86,11 +86,11 @@ class MenuItemCreate(ModelMutation):items = [cleaned_input.get('page'), cleaned_input.get('collection'),cleaned_input.get('url'), cleaned_input.get('category')]- items = list(filter(None.__ne__, items))+ items = [item for item in items if item is not None]if len(items) > 1:- field = 'items'- msg = 'More than one item provided.'- cls.add_error(errors=errors, field=field, message=msg)+ cls.add_error(+ errors=errors,+ field='items', message='More than one item provided.')return cleaned_inputdiff --git a/saleor/graphql/menu/types.py b/saleor/graphql/menu/types.pyindex b04906f205..25e1bf3935 100644--- a/saleor/graphql/menu/types.py+++ b/saleor/graphql/menu/types.py@@ -20,7 +20,7 @@ class MenuItem(CountableDjangoObjectType):description = """Represents a single item of the related menu.Can store categories, collection or pages."""interfaces = [relay.Node]- only_fields = ['id', 'name', 'url']+ only_fields = ['children', 'id', 'menu', 'name', 'url']filter_fields = {'name': ['icontains']}model = models.MenuItemdiff --git a/tests/api/test_menu.py b/tests/api/test_menu.pyindex 0888ec925e..6d064de3c8 100644--- a/tests/api/test_menu.py+++ b/tests/api/test_menu.py@@ -9,7 +9,7 @@ from tests.utils import get_graphql_contentdef test_menu_query(user_api_client, menu, menu_item):query = """query menus($menu_name: String){- menus(name: $menu_name) {+ menus(name_Icontains: $menu_name) {edges {node {name@@ -53,9 +53,7 @@ def test_menu_items_query(user_api_client, menu_item, collection):children {totalCount}- collection {- name- }+ url}}"""@@ -69,7 +67,7 @@ def test_menu_items_query(user_api_client, menu_item, collection):assert 'errors' not in contentdata = content['data']['menuItem']assert data['name'] == menu_item.name- assert data['collection']['name'] == menu_item.collection.name+ assert data['url'] == menu_item.collection.get_absolute_url()assert data['children']['totalCount'] == menu_item.children.count()@@ -165,9 +163,6 @@ def test_update_menu_item(admin_api_client, menu, menu_item, page):menuItemUpdate(id: $id, input: {menu: $menu_id, page: $page}) {menuItem {url- page {- title- }}}}@@ -185,8 +180,7 @@ def test_update_menu_item(admin_api_client, menu, menu_item, page):content = get_graphql_content(response)assert 'errors' not in contentdata = content['data']['menuItemUpdate']['menuItem']- assert not data['url']- assert data['page']['title'] == page.title+ assert data['url'] == page.get_absolute_url()def test_delete_menu_item(admin_api_client, menu_item):@@ -222,9 +216,6 @@ def test_add_more_than_one_item(admin_api_client, menu, menu_item, page):}menuItem {url- page {- title- }}}}