From 61a4743b62914559fea18a945f7a780e1394da2f Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 8 Feb 2016 21:55:07 +0530 Subject: Test exact return value of flow_export.curl_command --- test/test_export_flow.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_export_flow.py b/test/test_export_flow.py index 867c209a..d93912c8 100644 --- a/test/test_export_flow.py +++ b/test/test_export_flow.py @@ -4,7 +4,6 @@ from . import tutils req_get = netlib.tutils.treq( method='GET', - headers=None, content=None, ) @@ -13,10 +12,22 @@ req_post = netlib.tutils.treq( headers=None, ) +req_patch = netlib.tutils.treq( + method='PATCH', + path=b"/path?query=param", +) + -def test_request_simple(): +def test_curl_command(): flow = tutils.tflow(req=req_get) - assert flow_export.curl_command(flow) + result = """curl -H 'header:qvalue' 'http://address/path'""" + assert flow_export.curl_command(flow) == result flow = tutils.tflow(req=req_post) - assert flow_export.curl_command(flow) + result = """curl -X POST 'http://address/path' --data-binary 'content'""" + assert flow_export.curl_command(flow) == result + + flow = tutils.tflow(req=req_patch) + result = """curl -H 'header:qvalue' -X PATCH 'http://address/path?query=param' --data-binary 'content'""" + assert flow_export.curl_command(flow) == result + -- cgit v1.2.3