Skip to content

Commit

Permalink
Added test for the split_set_cookie option
Browse files Browse the repository at this point in the history
  • Loading branch information
Tudor Golubenco committed Dec 4, 2014
1 parent 33b37e4 commit 60b63ba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/packetbeat
Submodule packetbeat updated from 9d0e70 to 340162
1 change: 1 addition & 0 deletions tests/templates/packetbeat.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ idl_files = [

[http]
{% if http_send_all_headers %}send_all_headers = true{% endif %}
{% if http_split_set_cookie %}split_set_cookie = true{% endif %}
{% if http_send_headers -%}
send_headers = [{%- for hdr in http_send_headers -%}
"{{ hdr }}"
Expand Down
20 changes: 19 additions & 1 deletion tests/test_0006_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def test_send_headers_options(self):
assert "headers" in o["http"]["response"]
assert o["http"]["request"]["headers"]["cache-control"] == "max-age=0"
assert len(o["http"]["request"]["headers"]) == 9
assert len(o["http"]["response"]["headers"]) == 10
assert len(o["http"]["response"]["headers"]) == 7
assert isinstance(o["http"]["response"]["headers"]["set-cookie"], basestring)

self.render_config_template(
http_ports=[8888],
Expand All @@ -104,3 +105,20 @@ def test_send_headers_options(self):
assert len(o["http"]["request"]["headers"]) == 1
assert len(o["http"]["response"]["headers"]) == 1
assert "user-agent" in o["http"]["request"]["headers"]

def test_split_set_cookie(self):
self.render_config_template(
http_ports=[8888],
http_send_all_headers=True,
http_split_set_cookie=True,
)
self.run_packetbeat(pcap="wsgi_loopback.pcap")

objs = self.read_output()
assert len(objs) == 1
o = objs[0]

assert len(o["http"]["request"]["headers"]) == 9
assert len(o["http"]["response"]["headers"]) == 7
assert isinstance(o["http"]["response"]["headers"]["set-cookie"], dict)
assert len(o["http"]["response"]["headers"]["set-cookie"]) == 4

0 comments on commit 60b63ba

Please sign in to comment.