feat: only fetch published pathways (#36332)

* feat: only fetch published pathways
This commit is contained in:
zawan-ila
2025-03-07 12:42:33 +05:00
committed by GitHub
parent 0054eb2d33
commit ab3928284f
3 changed files with 4 additions and 2 deletions

View File

@@ -200,7 +200,7 @@ class Command(BaseCommand):
failure = False
logger.info(f'Requesting pathways for {site.domain}.')
try:
api_url = urljoin(f"{api_base_url}/", "pathways/")
api_url = urljoin(f"{api_base_url}/", "pathways/?status=published")
next_page = 1
while next_page:
response = client.get(api_url, params=dict(exclude_utm=1, page=next_page))

View File

@@ -142,6 +142,7 @@ class TestCachePrograms(CatalogIntegrationMixin, CacheIsolationTestCase, SiteMix
expected = {
'exclude_utm': ['1'],
'page': [str(page_number)],
'status': ['published']
}
assert request.querystring == expected
@@ -156,7 +157,7 @@ class TestCachePrograms(CatalogIntegrationMixin, CacheIsolationTestCase, SiteMix
httpretty.register_uri(
httpretty.GET,
self.pathway_url + f'?exclude_utm=1&page={page_number}',
self.pathway_url + f'?status=published&exclude_utm=1&page={page_number}',
body=pathways_callback,
content_type='application/json',
match_querystring=True,

View File

@@ -290,3 +290,4 @@ class PathwayFactory(DictFactoryBase):
org_name = factory.Faker('company')
programs = factory.LazyFunction(partial(generate_instances, ProgramFactory))
pathway_type = FuzzyChoice(path_type.value for path_type in PathwayType)
status = 'published'