예제 #1
0
 def test_building_file_path(self, get_file_content_mock):
     get_file_content_mock.return_value = """
         document.write('Hello world!');
     """
     fingerprinter = AssetFingerprinter()
     fingerprinter.get_url('javascripts/application.js')
     fingerprinter.get_asset_file_contents.assert_called_with(
         'app/static/javascripts/application.js')
 def test_building_file_path(self, get_file_content_mock):
     get_file_content_mock.return_value = """
         document.write('Hello world!');
     """
     fingerprinter = AssetFingerprinter()
     fingerprinter.get_url('javascripts/application.js')
     fingerprinter.get_asset_file_contents.assert_called_with(
         'app/static/javascripts/application.js'
     )
예제 #3
0
 def test_hash_gets_cached(self, get_file_content_mock):
     get_file_content_mock.return_value = """
         body {
             font-family: nta;
         }
     """
     fingerprinter = AssetFingerprinter()
     assert (fingerprinter.get_url('application.css') ==
             '/static/application.css?418e6f4a6cdf1142e45c072ed3e1c90a')
     fingerprinter._cache['application.css'] = 'a1a1a1'
     assert (fingerprinter.get_url('application.css') == 'a1a1a1')
     fingerprinter.get_asset_file_contents.assert_called_once_with(
         'app/static/application.css')
예제 #4
0
 def test_url_format(self, get_file_content_mock):
     get_file_content_mock.return_value = """
         body {
             font-family: nta;
         }
     """
     asset_fingerprinter = AssetFingerprinter(
         asset_root='/suppliers/static/')
     assert (
         asset_fingerprinter.get_url('application.css') ==
         '/suppliers/static/application.css?418e6f4a6cdf1142e45c072ed3e1c90a'  # noqa
     )
     assert (
         asset_fingerprinter.get_url('application-ie6.css') ==
         '/suppliers/static/application-ie6.css?418e6f4a6cdf1142e45c072ed3e1c90a'  # noqa
     )
 def test_url_format(self, get_file_content_mock):
     get_file_content_mock.return_value = """
         body {
             font-family: nta;
         }
     """
     asset_fingerprinter = AssetFingerprinter(
         asset_root='/suppliers/static/'
     )
     assert (
         asset_fingerprinter.get_url('application.css') ==
         '/suppliers/static/application.css?418e6f4a6cdf1142e45c072ed3e1c90a'  # noqa
     )
     assert (
         asset_fingerprinter.get_url('application-ie6.css') ==
         '/suppliers/static/application-ie6.css?418e6f4a6cdf1142e45c072ed3e1c90a'  # noqa
     )
 def test_hash_gets_cached(self, get_file_content_mock):
     get_file_content_mock.return_value = """
         body {
             font-family: nta;
         }
     """
     fingerprinter = AssetFingerprinter()
     assert (
         fingerprinter.get_url('application.css') ==
         '/static/application.css?418e6f4a6cdf1142e45c072ed3e1c90a'
     )
     fingerprinter._cache[
         'application.css'
     ] = 'a1a1a1'
     assert (
         fingerprinter.get_url('application.css') ==
         'a1a1a1'
     )
     fingerprinter.get_asset_file_contents.assert_called_once_with(
         'app/static/application.css'
     )