Example #1
0
 def test_with_custom_output(self):
     """build() method can write to a custom file object."""
     from webassets.six import StringIO
     buffer = StringIO()
     self.mkbundle('in1', 'in2', output='out').build(output=buffer)
     assert buffer.getvalue() == 'A\nB'
     assert not self.exists('out')    # file was not written.
Example #2
0
 def test_with_custom_output(self):
     """build() method can write to a custom file object."""
     from webassets.six import StringIO
     buffer = StringIO()
     self.mkbundle('in1', 'in2', output='out').build(output=buffer)
     assert buffer.getvalue() == 'A\nB'
     assert not self.exists('out')  # file was not written.
Example #3
0
 def http_open(self, req):
     url = req.get_full_url()
     try:
         content = self.urls[url]
     except KeyError:
         resp = addinfourl(StringIO(""), None, url)
         resp.code = 404
         resp.msg = "OK"
     else:
         resp = addinfourl(StringIO(content), None, url)
         resp.code = 200
         resp.msg = "OK"
     return resp
Example #4
0
 def __init__(self, fname, conf=None, data=''):
     super(FakeCSSFile, self).__init__(fname, conf=conf)
     self.data = StringIO.StringIO(data)