def test_request_post(self): environ = {'REQUEST_METHOD': 'POST', } req=Request(environ) r = self.widget(_no_autoid=True, **self.attrs).request(req) assert_eq_xhtml(r.body, """<html> <head><title>some title</title></head> <body><h1>some title</h1></body> </html>""")
def test_widget_relative_inheritance(self): twc.core.request_local()["middleware"] = twc.make_middleware(None) # These aren't yet supported in the tests yet. ignored_engines = ["jinja", "kajiki", "chameleon"] for engine in engines: if engine in ignored_engines: continue template = "%s:tw2.core.test_templates.child_%s" % (engine, engine) test = twc.Widget(id="x", template=template) expected = """ <html> <head><title>Parent</title></head> <body>Child</body> </html> """ assert_eq_xhtml(test.display(), expected)
def test_widget_relative_inheritance(self): twc.core.request_local()['middleware'] = twc.make_middleware(None) # These aren't yet supported in the tests yet. ignored_engines = ['jinja', 'kajiki', 'chameleon'] for engine in engines: if engine in ignored_engines: continue template = "%s:tw2.core.test_templates.child_%s" % (engine, engine) test = twc.Widget(id='x', template=template) expected = """ <html> <head><title>Parent</title></head> <body>Child</body> </html> """ assert_eq_xhtml(test.display(), expected)
def test_string_value(self): w = self.widget(**self.attrs)() w.value = "value" r = w.display("value") assert_eq_xhtml(r, self.expected)