Esempio n. 1
0
def test_inject():
    def _get_content_custom(self):
        response = """<html><head></head><body><h1>It works!</h1></body></html>"""
        return response

    hr = Highroller()
    hr._get_content = _get_content_custom
    hr.inject_head = "<!-- headinject -->"
    hr.inject_body = "<!-- bodyinject -->"
    hr.register_additional_site("/index.html")
    assert len(hr.additional_sites) == 1
    for element in hr.additional_sites:
        response = hr.roll_site(element)
        assert response == """<html><head><!-- headinject --></head><body><h1>It works!</h1><!-- bodyinject --></body></html>"""