Example #1
0
    def test_compile(self):
        compiler = GoogleAnalyticsCompiler(False, None)
        with self.settings(GOOGLE_ANALYTICS_ID='UA-12345-6'):
            outfile = os.path.join(self.tmp_static, 'google-analytics.min.js')
            assert not os.path.isfile(outfile)
            compiler.compile_file(SOURCE_FILE, outfile)
            assert not os.path.isfile(outfile)

            # Try again
            compiler.compile_file(SOURCE_FILE, outfile, outdated=True)
            assert os.path.isfile(outfile)
            # now the outfile should have been created
            with open(outfile) as f:
                content = f.read()
                assert 'UA-12345-6' in content
Example #2
0
 def test_match(self):
     compiler = GoogleAnalyticsCompiler(False, None)
     assert compiler.match_file('/foo/google_analytics.js')
     assert not compiler.match_file('/foo/bar.js')