Skip to content

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

Test for collection view

Mira Szewczyk32afb8ca2d37
diff --git a/tests/test_collection.py b/tests/test_collection.py
index c8914ec3c5..94b5d1d2af 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -9,7 +9,7 @@ from saleor.dashboard.collection.forms import CollectionForm
@pytest.fixture
def collection(db):
- collection = Collection.objects.create(name="Collection")
+ collection = Collection.objects.create(name="Collection", slug='collection')
return collection
@@ -89,3 +89,13 @@ def test_collection_delete_view(admin_client, collection):
assert Collection.objects.count() == (collections_count - 1)
+def test_collection_index(client, collection):
+ url = reverse(
+ 'product:collection',
+ kwargs={'slug': collection.slug, 'collection_id': collection.id})
+ response = client.get(url)
+ assert response.status_code == 200
+
+ context = response.context
+ assert context['collection'] == collection
+