def test_writeout(self): """ Output files written to correct location regardless of current working directory. """ # Remove any leftover file from previous test... if isfile('tests/_test.css'): unlink('tests/_test.css') # Even though working directory is the top-level, setting # static_folder should make all paths relative to './tests'. bundle = Bundle(['test01.css', 'test02.css'], output='_test.css', static_folder='tests') bundle.build_bundle() # Check file is in the right spot. ok_(isfile('tests/_test.css')) unlink('tests/_test.css')
def test_nobuild(self): """ Bundles with build=False not included in production. """ bundle = Bundle(['tests/test01.css', Bundle('tests/test02.css', build=False)]) data = bundle.build_bundle().getvalue() ok_('color: blue' not in data)
def test_filter(self): """ Running data through filter produces expected data hash. """ # Our special filter rot13 = Filter(('tests/rot13', '--')) bundle = Bundle(['tests/test01.css', 'tests/test02.css'], filters=rot13) # Call bundle build, which returns a StringIO handle data = bundle.build_bundle() # Check md5 hash h = hashlib.md5() h.update(data.getvalue()) assert_equal(h.hexdigest(), '6d4ab1ec47d4156b519b8ff510b51af3')