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>')
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>')
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>')
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>')
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>')