def test_generate_headers(self): method = "get" url = "http://example.com/api/v2/list" data = "" headers = '{ \"X-API-Key\": \"abcdef12345\", \"user-agent\": \"tntfuzzer\" }' expected_result = u'-H \"Content-type: application/json\" -H \"X-API-Key\": \"abcdef12345\" ' \ u'-H \"user-agent\": \"tntfuzzer\"' curlcommand = CurlCommand(url, method, data, headers) self.assertEquals(curlcommand.generate_headers(), expected_result)
def test_generate_headers_returns_contenttype_only_when_headers_nonetype(self): method = "get" url = "http://example.com/api/v2/list" data = "" expected_result = u'-H \"Content-type: application/json\"' curlcommand = CurlCommand(url, method, data, None) self.assertEqual(curlcommand.generate_headers(), expected_result)