Add tests for add_header example

This commit is contained in:
Shadab Zafar 2016-03-07 09:12:36 +05:30
parent a2274f52e4
commit 96df077d54

View File

@ -7,6 +7,7 @@ from netlib.http import Headers
from . import tservers, tutils from . import tservers, tutils
from examples import ( from examples import (
add_header,
modify_form, modify_form,
) )
@ -38,6 +39,12 @@ def test_load_scripts():
s.unload() s.unload()
def test_add_header():
flow = tutils.tflow(resp=netutils.tresp())
add_header.response({}, flow)
assert flow.response.headers["newheader"] == "foo"
def test_modify_form(): def test_modify_form():
form_header = Headers(content_type="application/x-www-form-urlencoded") form_header = Headers(content_type="application/x-www-form-urlencoded")
flow = tutils.tflow(req=netutils.treq(headers=form_header)) flow = tutils.tflow(req=netutils.treq(headers=form_header))