def test_hashes_are_consistent(self, get_file_content_mock): get_file_content_mock.return_value = """ body { font-family: nta; } """ asset_fingerprinter = AssetFingerprinter() assert (asset_fingerprinter.get_asset_fingerprint('application.css') == asset_fingerprinter.get_asset_fingerprint('same_contents.css'))
def test_hashes_are_consistent(self, get_file_content_mock): get_file_content_mock.return_value = """ body { font-family: nta; } """ asset_fingerprinter = AssetFingerprinter() assert ( asset_fingerprinter.get_asset_fingerprint('application.css') == asset_fingerprinter.get_asset_fingerprint('same_contents.css') )
def test_hashes_are_different_for_different_files(self, get_file_content_mock): asset_fingerprinter = AssetFingerprinter() get_file_content_mock.return_value = """ body { font-family: nta; } """ css_hash = asset_fingerprinter.get_asset_fingerprint('application.css') get_file_content_mock.return_value = """ document.write('Hello world!'); """ js_hash = asset_fingerprinter.get_asset_fingerprint('application.js') assert (js_hash != css_hash)
def test_hashes_are_different_for_different_files( self, get_file_content_mock ): asset_fingerprinter = AssetFingerprinter() get_file_content_mock.return_value = """ body { font-family: nta; } """ css_hash = asset_fingerprinter.get_asset_fingerprint('application.css') get_file_content_mock.return_value = """ document.write('Hello world!'); """ js_hash = asset_fingerprinter.get_asset_fingerprint('application.js') assert ( js_hash != css_hash )