Skip to content

Commit 8fef72a

Browse files
Use fixtures from conftest
1 parent af25242 commit 8fef72a

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

tests/test_category.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ def setup(self, client):
1313
with client.application.app_context():
1414
assert Category.query.count() == 0
1515

16-
@pytest.fixture
17-
def create_category(self, create_authenticated_headers):
18-
def _create(name, headers=None):
19-
if headers is None:
20-
headers = create_authenticated_headers()
21-
return self.client.post(
22-
"/category/create", json={"name": name}, headers=headers
23-
)
24-
25-
return _create
26-
2716
def _count_categories(self):
2817
with self.client.application.app_context():
2918
return Category.query.count()

tests/test_product.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@ def setup(self, client):
1414
with client.application.app_context():
1515
assert Product.query.count() == 0
1616

17-
@pytest.fixture
18-
def create_product(self, create_authenticated_headers):
19-
def _create(name, description=None, subcategories=None, headers=None):
20-
if headers is None:
21-
headers = create_authenticated_headers()
22-
payload = {"name": name}
23-
if description is not None:
24-
payload["description"] = description
25-
if subcategories is not None:
26-
payload["subcategories"] = subcategories
27-
return self.client.post(
28-
"/product/create", json=payload, headers=headers
29-
)
30-
return _create
31-
3217
def _count_products(self):
3318
with self.client.application.app_context():
3419
return Product.query.count()

tests/test_subcategory.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@ def setup(self, client):
1313
with client.application.app_context():
1414
assert Subcategory.query.count() == 0
1515

16-
@pytest.fixture
17-
def create_subcategory(self, create_authenticated_headers):
18-
def _create(name, categories=None, products=None, headers=None):
19-
if headers is None:
20-
headers = create_authenticated_headers()
21-
payload = {"name": name}
22-
if categories is not None:
23-
payload["categories"] = categories
24-
if products is not None:
25-
payload["products"] = products
26-
return self.client.post(
27-
"/subcategory/create", json=payload, headers=headers
28-
)
29-
return _create
30-
3116
def _count_subcategories(self):
3217
with self.client.application.app_context():
3318
return Subcategory.query.count()
@@ -59,8 +44,6 @@ def test_create_subcategory_duplicate_name(self, create_subcategory):
5944
assert self._count_subcategories() == 1
6045
self._verify_subcategory_in_db(self.TEST_SUBCATEGORY_NAME)
6146

62-
# TODO: Add tests for creation with categories and products when those fixtures/utilities are available
63-
6447
def test_get_subcategory_by_id(self, create_subcategory):
6548
response = create_subcategory("Laptops")
6649
data = response.get_json()

0 commit comments

Comments
 (0)