aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/test_cmdline.py14
-rw-r--r--test/test_dump.py6
2 files changed, 19 insertions, 1 deletions
diff --git a/test/test_cmdline.py b/test/test_cmdline.py
index 0a1d6e8f..e1c5c88d 100644
--- a/test/test_cmdline.py
+++ b/test/test_cmdline.py
@@ -36,7 +36,7 @@ def test_parse_replace_hook():
def test_parse_setheaders():
- x = cmdline.parse_replace_hook("/foo/bar/voing")
+ x = cmdline.parse_setheader("/foo/bar/voing")
assert x == ("foo", "bar", "voing")
@@ -53,6 +53,18 @@ def test_common():
assert v["stickycookie"] == "foo"
assert v["stickyauth"] == "foo"
+ opts.setheader = ["/foo/bar/voing"]
+ v = cmdline.get_common_options(opts)
+ assert v["setheaders"] == [("foo", "bar", "voing")]
+
+ opts.setheader = ["//"]
+ tutils.raises(
+ "empty clause",
+ cmdline.get_common_options,
+ opts
+ )
+ opts.setheader = []
+
opts.replace = ["/foo/bar/voing"]
v = cmdline.get_common_options(opts)
assert v["replacements"] == [("foo", "bar", "voing")]
diff --git a/test/test_dump.py b/test/test_dump.py
index 884a5b64..0337bb33 100644
--- a/test/test_dump.py
+++ b/test/test_dump.py
@@ -99,6 +99,12 @@ class TestDumpMaster:
f = self._cycle(m, "content")
assert f.request.content == "foo"
+ def test_setheader(self):
+ o = dump.Options(setheaders=[(".*", "one", "two")])
+ m = dump.DumpMaster(None, o, None)
+ f = self._cycle(m, "content")
+ assert f.request.headers["one"] == ["two"]
+
def test_basic(self):
for i in (1, 2, 3):
assert "GET" in self._dummy_cycle(1, "~s", "", verbosity=i, eventlog=True)