def test_timestamp_inserted_before_extensions(self): css_source1 = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True, timestamp=True) js_source1 = javascript_link('/deep/a.js', '/b.js', combined=True, minified=True, timestamp=True) css_source2 = stylesheet_link('/deep/a.css', minified=True, timestamp=True) js_source2 = javascript_link('/deep/a.js', minified=True, timestamp=True) css_source3 = stylesheet_link('/deep/a.css', '/b.css', combined=True, timestamp=True) js_source3 = javascript_link('/deep/a.js', '/b.js', combined=True, timestamp=True) self.assert_(re.search(r'/a\.b\.[0-9]+\.COMBINED\.min\.css', css_source1)) self.assert_(re.search(r'/a\.b\.[0-9]+\.COMBINED\.min\.js', js_source1)) self.assert_(re.search(r'/a\.[0-9]+\.min\.css', css_source2)) self.assert_(re.search(r'/a\.[0-9]+\.min\.js', js_source2)) self.assert_(re.search(r'/a\.b\.[0-9]+\.COMBINED\.css', css_source3)) self.assert_(re.search(r'/a\.b\.[0-9]+\.COMBINED\.js', js_source3))
def test_paths(self): """Testing if paths are constructed correctly""" # minify and combine js_source = javascript_link('/deep/a.js', '/b.js', combined=True, minified=True) css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True, minified=True) self.assert_('"/a.b.COMBINED.min.css"' in css_source) self.assert_('"/a.b.COMBINED.min.js"' in js_source) # combine js_source = javascript_link('/deep/a.js', '/b.js', combined=True) css_source = stylesheet_link('/deep/a.css', '/b.css', combined=True) self.assert_('"/a.b.COMBINED.css"' in css_source) self.assert_('"/a.b.COMBINED.js"' in js_source) # minify js_source = javascript_link('/deep/a.js', '/b.js', minified=True) css_source = stylesheet_link('/deep/a.css', '/b.css', minified=True) self.assert_('"/deep/a.min.css"' in css_source) self.assert_('"/b.min.css"' in css_source) self.assert_('"/deep/a.min.js"' in js_source) self.assert_('"/b.min.js"' in js_source) # root minify and combined js_source = javascript_link('/c.js', '/b.js', combined=True, minified=True) css_source = stylesheet_link('/c.css', '/b.css', combined=True, minified=True) self.assert_('"/c.b.COMBINED.min.css"' in css_source) self.assert_('"/c.b.COMBINED.min.js"' in js_source) # root minify js_source = javascript_link('/c.js', '/b.js', minified=True) css_source = stylesheet_link('/c.css', '/b.css', minified=True) self.assert_('"/b.min.css"' in css_source) self.assert_('"/b.min.js"' in js_source) self.assert_('"/c.min.js"' in js_source) self.assert_('"/c.min.js"' in js_source) # both root minify and combined js_source = javascript_link('/deep/a.js', '/deep/d.js', combined=True, minified=True) css_source = stylesheet_link('/deep/a.css', '/deep/d.css', combined=True, minified=True) self.assert_('"/deep/a.d.COMBINED.min.css"' in css_source) self.assert_('"/deep/a.d.COMBINED.min.js"' in js_source)
def test_two_deep_paths(self): js_source = javascript_link('/js/1.js', '/jquery/2.js', combined=True, minified=True) css_source = stylesheet_link('/js/1.css', '/jquery/2.css', combined=True, minified=True) self.assert_('"/1.2.COMBINED.min.css"' in css_source) self.assert_('"/1.2.COMBINED.min.js"' in js_source)
def test_strip_prefix(self): js_source = javascript_link('/TEST/deep/a.js', '/TEST/b.js', combined=True, minified=True, strip_prefix="/TEST") css_source = stylesheet_link('/TEST/deep/a.css', '/TEST/b.css', combined=True, minified=True, strip_prefix="/TEST") self.assert_('"/TEST/a.b.COMBINED.min.css"' in css_source) self.assert_('"/TEST/a.b.COMBINED.min.js"' in js_source)
def test_specified_filename(self): js_source = javascript_link('/js/1.js', '/jquery/2.js', combined=True, minified=True, combined_filename="w00t_1") css_source = stylesheet_link('/js/1.css', '/jquery/2.css', combined=True, minified=True, combined_filename="foobar") self.assert_('"/w00t_1.COMBINED.min.js"' in js_source) self.assert_('"/foobar.COMBINED.min.css"' in css_source)