Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Added tests
oldPadavan1adf439a71d0
diff --git a/tests/dashboard/test_collection.py b/tests/dashboard/test_collection.pyindex b08f6338e3..f025adf968 100644--- a/tests/dashboard/test_collection.py+++ b/tests/dashboard/test_collection.py@@ -15,6 +15,16 @@ def test_list_view(admin_client, collection):assert list(context['collections']) == [collection]+def test_set_homepage_collection(admin_client, collection, site_settings):+ data = {'homepage_collection': collection.pk}+ response = admin_client.post(reverse('dashboard:collection-list'), data)+ assert response.status_code == 302+ redirect_url = reverse('dashboard:collection-list')+ assert get_redirect_location(response) == redirect_url+ site_settings.refresh_from_db()+ assert site_settings.homepage_collection == collection++def test_collection_form_name():data = {'name': 'Test Collection', 'products': []}form = CollectionForm(data)diff --git a/tests/test_product.py b/tests/test_product.pyindex 66c637a8fd..79d7fb773b 100644--- a/tests/test_product.py+++ b/tests/test_product.py@@ -647,3 +647,18 @@ def test_get_product_attributes_data_translation(attributes_data = get_product_attributes_data(product)attributes_keys = [attr.name for attr in attributes_data.keys()]assert translated_product_attribute.name in attributes_keys+++def test_homepage_collection_render(+ client, site_settings, collection, product_list):+ collection.products.add(*product_list)+ site_settings.homepage_collection = collection+ site_settings.save()++ response = client.get(reverse('home'))+ assert response.status_code == 200+ products_in_context = {+ product[0] for product in response.context['products']}+ products_available = {+ product for product in product_list if product.is_published}+ assert products_in_context == products_available