fixed product views to only list active products
This commit is contained in:
@@ -11,7 +11,7 @@ from rest_framework.test import APITestCase
|
||||
from rest_framework import status
|
||||
|
||||
from companies.factories import CompanyFactory
|
||||
from products.factories import ProductFactory
|
||||
from products.factories import ProductFactory, ActiveProductFactory
|
||||
from products.models import Product
|
||||
from products.utils import find_related_products_v3
|
||||
|
||||
@@ -28,7 +28,7 @@ class ProductViewSetTest(APITestCase):
|
||||
"""Tests setup
|
||||
"""
|
||||
self.endpoint = '/api/v1/products/'
|
||||
self.factory = ProductFactory
|
||||
self.factory = ActiveProductFactory
|
||||
self.model = Product
|
||||
# create user
|
||||
self.password = ''.join(random.choices(string.ascii_uppercase, k = 10))
|
||||
@@ -425,7 +425,7 @@ class LoadCoopProductsTestCase(APITestCase):
|
||||
"""
|
||||
self.endpoint = '/api/v1/load_products/'
|
||||
self.model = Product
|
||||
self.factory = ProductFactory
|
||||
self.factory = ActiveProductFactory
|
||||
# create admin user
|
||||
self.admin_email = f"admin_user@mail.com"
|
||||
self.password = ''.join(random.choices(string.ascii_uppercase, k = 10))
|
||||
@@ -504,7 +504,7 @@ class ProductSearchTest(TestCase):
|
||||
"""
|
||||
self.endpoint = '/api/v1/search_products/'
|
||||
self.model = Product
|
||||
self.factory = ProductFactory
|
||||
self.factory = ActiveProductFactory
|
||||
# create admin user
|
||||
self.admin_email = "admin_user@mail.com"
|
||||
self.password = ''.join(random.choices(string.ascii_uppercase, k = 10))
|
||||
@@ -923,7 +923,7 @@ class MyProductsViewTest(APITestCase):
|
||||
"""Tests setup
|
||||
"""
|
||||
self.endpoint = '/api/v1/my_products/'
|
||||
self.factory = ProductFactory
|
||||
self.factory = ActiveProductFactory
|
||||
self.model = Product
|
||||
# create user
|
||||
self.email = f"user@mail.com"
|
||||
@@ -986,7 +986,7 @@ class FindRelatedProductsTest(APITestCase):
|
||||
def setUp(self):
|
||||
"""Tests setup
|
||||
"""
|
||||
self.factory = ProductFactory
|
||||
self.factory = ActiveProductFactory
|
||||
self.model = Product
|
||||
# clear table
|
||||
self.model.objects.all().delete()
|
||||
|
||||
Reference in New Issue
Block a user