Exclude UTM parameters from marketing URLs when caching programs

LEARNER-382
This commit is contained in:
Renzo Lucioni
2017-05-12 11:20:50 -04:00
parent 4919868c79
commit 49b11cb697
2 changed files with 10 additions and 2 deletions

View File

@@ -58,7 +58,7 @@ class Command(BaseCommand):
for uuid in uuids:
try:
logger.info('Requesting details for program {uuid}.'.format(uuid=uuid))
program = client.programs(uuid).get()
program = client.programs(uuid).get(exclude_utm=1)
cache_key = PROGRAM_CACHE_KEY_TPL.format(uuid=uuid)
programs[cache_key] = program

View File

@@ -46,10 +46,18 @@ class TestCachePrograms(CatalogIntegrationMixin, CacheIsolationTestCase):
)
def mock_detail(self, uuid, program):
def detail_callback(request, uri, headers):
expected = {
'exclude_utm': ['1'],
}
self.assertEqual(request.querystring, expected)
return (200, headers, json.dumps(program))
httpretty.register_uri(
httpretty.GET,
self.detail_tpl.format(uuid=uuid),
body=json.dumps(program),
body=detail_callback,
content_type='application/json'
)