Add leading period so we don't get partial matches on extensions.

This commit is contained in:
Toby Lawrence
2016-02-02 10:07:13 -05:00
parent 1183f6cec9
commit e57d1a2006
3 changed files with 8 additions and 7 deletions

View File

@@ -445,6 +445,7 @@ class CanonicalContentTest(SharedModuleStoreTestCase):
)
@ddt.unpack
def test_canonical_asset_path_with_new_style_assets(self, base_url, start, expected, mongo_calls):
exts = ['.html', '.tm']
prefix = 'split'
encoded_base_url = quote_plus('//' + base_url)
c4x = 'c4x/a/b/asset'
@@ -473,7 +474,7 @@ class CanonicalContentTest(SharedModuleStoreTestCase):
)
with check_mongo_calls(mongo_calls):
asset_path = StaticContent.get_canonicalized_asset_path(self.courses[prefix].id, start, base_url, ['html'])
asset_path = StaticContent.get_canonicalized_asset_path(self.courses[prefix].id, start, base_url, exts)
self.assertEqual(asset_path, expected)
@ddt.data(
@@ -630,6 +631,7 @@ class CanonicalContentTest(SharedModuleStoreTestCase):
)
@ddt.unpack
def test_canonical_asset_path_with_c4x_style_assets(self, base_url, start, expected, mongo_calls):
exts = ['.html', '.tm']
prefix = 'old'
c4x_block = 'c4x/a/b/asset'
encoded_c4x_block = quote_plus('/' + c4x_block + '/')
@@ -649,5 +651,5 @@ class CanonicalContentTest(SharedModuleStoreTestCase):
)
with check_mongo_calls(mongo_calls):
asset_path = StaticContent.get_canonicalized_asset_path(self.courses[prefix].id, start, base_url, ['html'])
asset_path = StaticContent.get_canonicalized_asset_path(self.courses[prefix].id, start, base_url, exts)
self.assertEqual(asset_path, expected)