Example #1
0
 def test_single(self):
     response = testing.DummyRequest().response
     response.unicode_body = u"<html><body></body></html>"
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({"settings":{"str": u"<body>", "new": u"<body>Updated!"}})
     response = filterinc.replacestr(response, request, settings, request.url)
     self.assertTrue(response.unicode_body==u"<html><body>Updated!</body></html>", response.unicode_body)
Example #2
0
 def test_chameleon_path3(self):
     response = testing.DummyRequest().response
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({"settings":{"template": "outpost.tests:tmpl.pt"}})
     config = testing.setUp(request=request)
     config.include('pyramid_chameleon')
     response = filterinc.template(response, request, settings, request.url)
     self.assertTrue(response.unicode_body==u"<html><body></body></html>")
Example #3
0
 def test_chameleon_empty(self):
     response = testing.DummyRequest().response
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({"settings":{"template": "tmpl.pt"}})
     config = testing.setUp(request=request)
     config.include('pyramid_chameleon')
     os.chdir(os.path.dirname(__file__))
     response = filterinc.template(response, request, settings, request.url)
     self.assertTrue(response.unicode_body==u"<html><body></body></html>")
Example #4
0
 def test_nosettings(self):
     response = testing.DummyRequest().response
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({"settings":{"str": "", "new": ""}})
     response = filterinc.replacestr(response, request, settings, request.url)
     self.assertTrue(response.unicode_body==u"")
Example #5
0
 def test_empty(self):
     response = {}
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({})
     response = filterinc.replacestr(response, request, settings, request.url)
     self.assertTrue(response=={})
Example #6
0
 def test_notmpl(self):
     response = testing.DummyRequest().response
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({"settings":{"template": "None"}})
     self.assertRaises(ValueError, filterinc.template, response, request, settings, request.url)
Example #7
0
 def test_empty(self):
     response = {}
     request = testing.DummyRequest()
     settings = FilterConf.fromDict({"settings":{"template": None}})
     response = filterinc.template(response, request, settings, request.url)
     self.assertTrue(response=={})