Ejemplo n.º 1
0
def test_eq_xhtml():
    b = "<foo><bar>Value</bar></foo>"
    c = """
<foo>
    <bar>
        Value
    </bar>
</foo>
"""
    ops.eq_xhtml(b, c)
Ejemplo n.º 2
0
def test_eq_html_wrapped():
    b = "<foo></foo><bar>Value</bar>"
    c = """
<foo>
</foo>
    <bar>
        Value
    </bar>
"""
    ops.eq_xhtml(b, c, True)
Ejemplo n.º 3
0
 def test_no_inject_head(self):
     rl = testapi.request(1, mw)
     js.req(no_inject=True).prepare()
     out = twc.inject_resources(html)
     assert eq_xhtml(
         out,
         '<html><head><title>a</title></head><body>hello</body></html>')
Ejemplo n.º 4
0
 def test_inject_head(self):
     rl = testapi.request(1, mw)
     js.inject()
     csssrc.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(out, '<html><head><script type="text/javascript" src="paj"></script>\
         <style type="text/css">.bob { font-weight: bold; }</style>\
         <title>a</title></head><body>hello</body></html>')
Ejemplo n.º 5
0
 def test_inject_jssrc_twice(self):
     rl = testapi.request(1, mw)
     jssrc.inject()
     jssrc.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(out, '<html><head>\
         <title>a</title></head><body>hello<script type="text/javascript">bob</script>\
         </body></html>')
Ejemplo n.º 6
0
 def test_inject_csssrc_twice(self):
     rl = testapi.request(1, mw)
     csssrc.inject()
     csssrc.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(out, '<html><head>\
         <style type="text/css">.bob { font-weight: bold; }</style>\
         <title>a</title></head><body>hello</body></html>')
Ejemplo n.º 7
0
 def test_inject_css(self):
     rl = testapi.request(1, mw)
     csssrc.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(
         out,
         '<html><head><style type="text/css">.bob { font-weight: bold; }</style>\
         <title>a</title></head><body>hello</body></html>')
Ejemplo n.º 8
0
 def test_inject_body(self):
     rl = testapi.request(1, mw)
     jssrc.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(
         out,
         '<html><head><title>a</title></head><body>hello<script type="text/javascript">bob</script></body></html>'
     )
Ejemplo n.º 9
0
    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>""")
Ejemplo n.º 10
0
 def test_inject_js_twice(self):
     rl = testapi.request(1, mw)
     js.inject()
     js.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(
         out, '<html><head>\
         <script type="text/javascript" src="paj"></script>\
         <title>a</title></head><body>hello</body></html>')
Ejemplo n.º 11
0
    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>""")
Ejemplo n.º 12
0
 def test_inject_head(self):
     rl = testapi.request(1, mw)
     js.inject()
     csssrc.inject()
     out = twc.inject_resources(html)
     print out
     assert eq_xhtml(
         out,
         '<html><head><script type="text/javascript" src="paj"></script>\
         <style type="text/css">.bob { font-weight: bold; }</style>\
         <title>a</title></head><body>hello</body></html>')
Ejemplo n.º 13
0
 def test_no_inject_head(self):
     rl = testapi.request(1, mw)
     js.req(no_inject=True).prepare()
     out = twc.inject_resources(html)
     assert eq_xhtml(out, '<html><head><title>a</title></head><body>hello</body></html>')
Ejemplo n.º 14
0
 def test_string_value(self):
     w = self.widget(**self.attrs)()
     w.value = "value"
     r = w.display("value")
     assert eq_xhtml(r, self.expected)
Ejemplo n.º 15
0
 def test_mw_inject(self):
     testapi.request(1, mw)
     assert eq_xhtml(tst_mw.get('/').body, '<html><head><script type="text/javascript" src="paj"></script><title>a</title></head><body>hello</body></html>')
Ejemplo n.º 16
0
 def test_string_value(self):
     w = self.widget(**self.attrs)()
     w.value = "value"
     r = w.display("value")
     assert eq_xhtml(r, self.expected)
Ejemplo n.º 17
0
def test_bad_xhtml():
    b = '<foo'
    ops.eq_xhtml(b, b)
Ejemplo n.º 18
0
 def test_mw_inject(self):
     testapi.request(1, mw)
     assert eq_xhtml(
         tst_mw.get('/').body,
         '<html><head><script type="text/javascript" src="paj"></script><title>a</title></head><body>hello</body></html>'
     )
Ejemplo n.º 19
0
def test_bad_xhtml_too():
    ops.eq_xhtml("<foo/>", '<foo')
Ejemplo n.º 20
0
 def test_inject_head(self):
     rl = testapi.request(1, mw)
     js.inject()
     out = twc.inject_resources(html)
     assert eq_xhtml(out, '<html><head><script type="text/javascript" src="paj"></script><title>a</title></head><body>hello</body></html>')