Esempio n. 1
0
    def test_should_generate_unique_version_identifier(self):
        versions = []
        for i in range(0, self.MAX_VERSIONS):
            version = generate_resource_version_identifier()
            if version not in versions:
                versions.append(version)

        self.assertEqual(self.MAX_VERSIONS, len(versions))
Esempio n. 2
0
    def test_should_load_resource_version_from_file_if_exists(self):
        version = generate_resource_version_identifier()
        save_resource_version_identifier(version)

        filename = get_resource_version_filename()
        self.assertTrue(os.path.isfile(filename))

        loaded_version = load_resource_version_identifier()
        os.remove(filename)
        self.assertEqual(version, loaded_version)
Esempio n. 3
0
    def test_should_save_version_to_file(self):
        version = generate_resource_version_identifier()
        save_resource_version_identifier(version)

        filename = get_resource_version_filename()
        self.assertTrue(os.path.isfile(filename))

        content = file_get_contents(filename)
        os.remove(filename)
        self.assertEqual(version, content)
Esempio n. 4
0
 def setUp(self):
     self.identifier = generate_resource_version_identifier()
     self.filenames = []
Esempio n. 5
0
 def test_should_include_revision_identifier_for_js_resource_filename(self):
     identifier = generate_resource_version_identifier()
     self.assertEqual(
         'cubane.testapp.%s.min.js' % identifier,
         get_minified_filename('testapp', 'js', identifier=identifier))
Esempio n. 6
0
 def test_should_contain_revision_number_if_configured(self):
     identifier = generate_resource_version_identifier()
     self.assertEqual('cubane.svgicons.frontend.%s.svg' % identifier, get_svgicons_filename('frontend', identifier))
Esempio n. 7
0
 def test_should_ignore_identifier_if_revisions_are_not_tracked(self):
     identifier = generate_resource_version_identifier()
     self.assertEqual('cubane.svgicons.frontend.svg', get_svgicons_filename('frontend', identifier='foo'))