Skip to content

Commit ecc5d5f

Browse files
committed
chore: depend on flag
1 parent 0f1f025 commit ecc5d5f

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

bc_obps/registration/tests/endpoints/test_regulated_products.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import pytest
21
from registration.models import RegulatedProduct
32
from registration.tests.utils.helpers import CommonTestSetup, TestUtils
43
from registration.utils import custom_reverse_lazy
54

65

76
class TestRegulatedProductsEndpoint(CommonTestSetup):
8-
@pytest.mark.skip("Until the new pulp and paper product takes effect")
97
def test_users_can_get_regulated_products(self):
108
response = TestUtils.mock_get_with_auth_role(
119
self, "industry_user", custom_reverse_lazy("list_regulated_products")

bc_obps/service/data_access_service/regulated_product_service.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import Optional
2+
from django.conf import settings
23
from registration.models import RegulatedProduct
34
from registration.schema import RegulatedProductSchema
45
from django.core.cache import cache
@@ -12,8 +13,11 @@ def get_regulated_products(cls) -> QuerySet[RegulatedProduct]:
1213
if cached_data:
1314
return cached_data
1415
else:
15-
regulated_products = RegulatedProduct.objects.exclude(name="Pulp and paper: lime recovered by kiln").only(
16-
*RegulatedProductSchema.Meta.fields
17-
)
16+
if settings.RESTRICTED_NAICS_CODES_FOR_REPORTING:
17+
regulated_products = RegulatedProduct.objects.exclude(
18+
name="Pulp and paper: lime recovered by kiln"
19+
).only(*RegulatedProductSchema.Meta.fields)
20+
else:
21+
regulated_products = RegulatedProduct.objects.only(*RegulatedProductSchema.Meta.fields)
1822
cache.set("regulated_products", regulated_products, 60 * 60 * 24 * 1) # 1 day
1923
return regulated_products

0 commit comments

Comments
 (0)