def test_folder_creation(self): """Test how folders are created""" js_source = javascript_link( dict(file='/deep/a.js', minify='minify'), dict(file='/deep/d.js', minify='minify'), combined='/a-new-folder/ad.js') self.assert_('"/a-new-folder/ad.js"' in js_source) folder = os.path.join(self.fixture_path, 'a-new-folder') # Check that the folder is rwxr-xr-x self.assertEquals(os.stat(folder).st_mode & 0777, 0755)
def test_two_deep_paths(self): js_source = javascript_link( dict(file='/js/1.js', minify='minify'), dict(file='/jquery/2.js', minify='minify'), combined='/js/1.2.js') self.assert_('"/js/1.2.js"' in js_source) css_source = stylesheet_link( dict(file='/js/1.css', minify='minify'), dict(file='/jquery/2.css', minify='minify'), combined='/js/1.2.css') self.assert_('"/js/1.2.css"' in css_source)
def test_paths(self): """Testing if paths are constructed correctly""" # minify and combine js_source = javascript_link( dict(file='/deep/a.js', minify='minify'), '/b.js', combined='ab.combined.js') self.assert_('"/ab.combined.js"' in js_source) css_source = stylesheet_link( dict(file='/deep/a.css', minify='minify'), '/b.css', combined='ab.combined.css') self.assert_('"/ab.combined.css"' in css_source) # combine js_source = javascript_link('/deep/a.js', '/b.js', combined='ab.js') self.assert_('"/ab.js"' in js_source) css_source = stylesheet_link('/deep/a.css', '/b.css', combined='ab.css') self.assert_('"/ab.css"' in css_source) # minify js_source = javascript_link( dict(file='/deep/a.js', minify='minify', dest='/deep/a.m.js'), dict(file='/b.js', minify='minify', dest='/b.m.js')) self.assert_('"/deep/a.m.js"' in js_source) self.assert_('"/b.m.js"' in js_source) css_source = stylesheet_link( dict(file='/deep/a.css', minify='minify', dest='/deep/a.m.css'), dict(file='/b.css', minify='minify', dest='/b.m.css')) self.assert_('"/deep/a.m.css"' in css_source) self.assert_('"/b.m.css"' in css_source) # root minify and combined js_source = javascript_link( dict(file='/c.js', minify='minify'), dict(file='/b.js', minify='minify'), combined='cb.mc.js') self.assert_('"/cb.mc.js"' in js_source) css_source = stylesheet_link( dict(file='/c.css', minify='minify'), dict(file='/b.css', minify='minify'), combined='cb.mc.css') self.assert_('"/cb.mc.css"' in css_source) # root minify js_source = javascript_link( dict(file='/b.js', minify='minify', dest='b.min.js'), dict(file='/c.js', minify='minify', dest='c.min.js')) self.assert_('"/b.min.js"' in js_source) self.assert_('"/c.min.js"' in js_source) css_source = stylesheet_link( dict(file='/b.css', minify='minify', dest='b.min.css'), dict(file='/c.css', minify='minify', dest='c.min.css')) self.assert_('"/b.min.css"' in css_source) self.assert_('"/c.min.css"' in css_source) # both deep minify and combined js_source = javascript_link( dict(file='/deep/a.js', minify='minify'), dict(file='/deep/d.js', minify='minify'), combined='/deep/ad.js') self.assert_('"/deep/ad.js"' in js_source) css_source = stylesheet_link( dict(file='/deep/a.css', minify='minify'), dict(file='/deep/d.css', minify='minify'), combined='/deep/ad.css') self.assert_('"/deep/ad.css"' in css_source)