From 77bcd616cd6dd3352dede1e14d8b9ce0f2cf5fdb Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sun, 4 Feb 2024 14:51:01 -0800 Subject: [PATCH] add tests for curl-head and http-headers parsers --- .../generic/curl_head--ILvs-example-com.json | 1 + .../generic/curl_head--ILvs-example-com.out | 66 +++++++++++++++++++ .../generic/curl_head--ILvs-google-com.json | 1 + .../generic/curl_head--ILvs-google-com.out | 44 +++++++++++++ .../generic/http_headers--example-com.json | 1 + .../generic/http_headers--example-com.out | 18 +++++ .../generic/http_headers--google-com.json | 1 + .../generic/http_headers--google-com.out | 27 ++++++++ tests/test_curl_head.py | 27 ++++++++ tests/test_http_headers.py | 27 ++++++++ 10 files changed, 213 insertions(+) create mode 100644 tests/fixtures/generic/curl_head--ILvs-example-com.json create mode 100644 tests/fixtures/generic/curl_head--ILvs-example-com.out create mode 100644 tests/fixtures/generic/curl_head--ILvs-google-com.json create mode 100644 tests/fixtures/generic/curl_head--ILvs-google-com.out create mode 100644 tests/fixtures/generic/http_headers--example-com.json create mode 100644 tests/fixtures/generic/http_headers--example-com.out create mode 100644 tests/fixtures/generic/http_headers--google-com.json create mode 100644 tests/fixtures/generic/http_headers--google-com.out create mode 100644 tests/test_curl_head.py create mode 100644 tests/test_http_headers.py diff --git a/tests/fixtures/generic/curl_head--ILvs-example-com.json b/tests/fixtures/generic/curl_head--ILvs-example-com.json new file mode 100644 index 00000000..99fa4e9c --- /dev/null +++ b/tests/fixtures/generic/curl_head--ILvs-example-com.json @@ -0,0 +1 @@ +[{"type":"request","request_method":"HEAD","request_uri":"/","request_version":"HTTP/1.1","host":"example.com","user-agent":"curl/8.1.2","accept":["*/*"]},{"type":"response","response_version":"HTTP/1.1","response_status":200,"response_reason":["OK"],"accept-ranges":["bytes"],"age":155553,"cache-control":["max-age=604800"],"content-type":"text/html; charset=UTF-8","date":"Sun, 04 Feb 2024 04:09:08 GMT","etag":"\"3147526947\"","expires":"Sun, 11 Feb 2024 04:09:08 GMT","last-modified":"Thu, 17 Oct 2019 07:18:26 GMT","server":["ECS (sac/2575)"],"x-cache":"HIT","content-length":1256,"date_epoch_utc":1707019748,"expires_epoch_utc":1707624548,"last-modified_epoch_utc":1571296706},{"type":"request","request_method":"HEAD","request_uri":"/","request_version":"HTTP/1.1","host":"google.com","user-agent":"curl/8.1.2","accept":["*/*"]},{"type":"response","response_version":"HTTP/1.1","response_status":301,"response_reason":["Moved Permanently"],"location":"http://www.google.com/","content-type":"text/html; charset=UTF-8","content-security-policy-report-only":["object-src 'none';base-uri 'self';script-src 'nonce-h6Y2V2d8R2XnuFpYfdFwBw' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp"],"date":"Sun, 04 Feb 2024 04:09:18 GMT","expires":"Tue, 05 Mar 2024 04:09:18 GMT","cache-control":["public","max-age=2592000"],"server":["gws"],"content-length":219,"x-xss-protection":"0","x-frame-options":"SAMEORIGIN","date_epoch_utc":1707019758,"expires_epoch_utc":1709611758},{"type":"request","request_method":"HEAD","request_uri":"/","request_version":"HTTP/1.1","host":"www.google.com","user-agent":"curl/8.1.2","accept":["*/*"]},{"type":"response","response_version":"HTTP/1.1","response_status":200,"response_reason":["OK"],"content-type":"text/html; charset=ISO-8859-1","content-security-policy-report-only":["object-src 'none';base-uri 'self';script-src 'nonce-rPJVLmgNCmplCGI-2Clr8Q' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp"],"p3p":"CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"","date":"Sun, 04 Feb 2024 04:09:18 GMT","server":["gws"],"x-xss-protection":"0","x-frame-options":"SAMEORIGIN","transfer-encoding":["chunked"],"expires":"Sun, 04 Feb 2024 04:09:18 GMT","cache-control":["private"],"set-cookie":["1P_JAR=2024-02-04-04; expires=Tue, 05-Mar-2024 04:09:18 GMT; path=/; domain=.google.com; Secure","AEC=Ae3NU9Oy-3rzqylRQBgIaeX68Gx3KlkSE8tsoeXZ7xlP6SZ91VmyvVn4vw; expires=Fri, 02-Aug-2024 04:09:18 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax","NID=511=BQdbZ7khjSQZ_Q8XQ9l5pUR0EA6vAT9Ww2tmedQFqp22X9N8e3IfUR5CrSL5zK5_hU_H6ApeyI7ekrOIK8HDYQ_KLkYhrTZZa5pLY4ggfbJDIG0eOExq90kPD7r5iGZnGs4Zm3w2TXua-yGy1NpQeCDqC5BZrwlmrQqqYFF8lHs; expires=Mon, 05-Aug-2024 04:09:18 GMT; path=/; domain=.google.com; HttpOnly"],"date_epoch_utc":1707019758,"expires_epoch_utc":1707019758}] diff --git a/tests/fixtures/generic/curl_head--ILvs-example-com.out b/tests/fixtures/generic/curl_head--ILvs-example-com.out new file mode 100644 index 00000000..38178a0e --- /dev/null +++ b/tests/fixtures/generic/curl_head--ILvs-example-com.out @@ -0,0 +1,66 @@ +* Trying [2606:2800:220:1:248:1893:25c8:1946]:80... +* Connected to example.com (2606:2800:220:1:248:1893:25c8:1946) port 80 (#0) +> HEAD / HTTP/1.1 +> Host: example.com +> User-Agent: curl/8.1.2 +> Accept: */* +> +< HTTP/1.1 200 OK +< Accept-Ranges: bytes +< Age: 155553 +< Cache-Control: max-age=604800 +< Content-Type: text/html; charset=UTF-8 +< Date: Sun, 04 Feb 2024 04:09:08 GMT +< Etag: "3147526947" +< Expires: Sun, 11 Feb 2024 04:09:08 GMT +< Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT +< Server: ECS (sac/2575) +< X-Cache: HIT +< Content-Length: 1256 +< +* Connection #0 to host example.com left intact +√ ~/temp % curl -ILvs http://google.com 2>&1 > /dev/null +* Trying [2607:f8b0:4002:c08::65]:80... +* Connected to google.com (2607:f8b0:4002:c08::65) port 80 (#0) +> HEAD / HTTP/1.1 +> Host: google.com +> User-Agent: curl/8.1.2 +> Accept: */* +> +< HTTP/1.1 301 Moved Permanently +< Location: http://www.google.com/ +< Content-Type: text/html; charset=UTF-8 +< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-h6Y2V2d8R2XnuFpYfdFwBw' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp +< Date: Sun, 04 Feb 2024 04:09:18 GMT +< Expires: Tue, 05 Mar 2024 04:09:18 GMT +< Cache-Control: public, max-age=2592000 +< Server: gws +< Content-Length: 219 +< X-XSS-Protection: 0 +< X-Frame-Options: SAMEORIGIN +< +* Connection #0 to host google.com left intact +* Issue another request to this URL: 'http://www.google.com/' +* Trying [2607:f8b0:4023:1009::6a]:80... +* Connected to www.google.com (2607:f8b0:4023:1009::6a) port 80 (#1) +> HEAD / HTTP/1.1 +> Host: www.google.com +> User-Agent: curl/8.1.2 +> Accept: */* +> +< HTTP/1.1 200 OK +< Content-Type: text/html; charset=ISO-8859-1 +< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-rPJVLmgNCmplCGI-2Clr8Q' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp +< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info." +< Date: Sun, 04 Feb 2024 04:09:18 GMT +< Server: gws +< X-XSS-Protection: 0 +< X-Frame-Options: SAMEORIGIN +< Transfer-Encoding: chunked +< Expires: Sun, 04 Feb 2024 04:09:18 GMT +< Cache-Control: private +< Set-Cookie: 1P_JAR=2024-02-04-04; expires=Tue, 05-Mar-2024 04:09:18 GMT; path=/; domain=.google.com; Secure +< Set-Cookie: AEC=Ae3NU9Oy-3rzqylRQBgIaeX68Gx3KlkSE8tsoeXZ7xlP6SZ91VmyvVn4vw; expires=Fri, 02-Aug-2024 04:09:18 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax +< Set-Cookie: NID=511=BQdbZ7khjSQZ_Q8XQ9l5pUR0EA6vAT9Ww2tmedQFqp22X9N8e3IfUR5CrSL5zK5_hU_H6ApeyI7ekrOIK8HDYQ_KLkYhrTZZa5pLY4ggfbJDIG0eOExq90kPD7r5iGZnGs4Zm3w2TXua-yGy1NpQeCDqC5BZrwlmrQqqYFF8lHs; expires=Mon, 05-Aug-2024 04:09:18 GMT; path=/; domain=.google.com; HttpOnly +< +* Connection #1 to host www.google.com left intact diff --git a/tests/fixtures/generic/curl_head--ILvs-google-com.json b/tests/fixtures/generic/curl_head--ILvs-google-com.json new file mode 100644 index 00000000..100edbf9 --- /dev/null +++ b/tests/fixtures/generic/curl_head--ILvs-google-com.json @@ -0,0 +1 @@ +[{"type":"request","request_method":"HEAD","request_uri":"/","request_version":"HTTP/1.1","host":"google.com","user-agent":"curl/8.1.2","accept":["*/*"]},{"type":"response","response_version":"HTTP/1.1","response_status":301,"response_reason":["Moved Permanently"],"location":"http://www.google.com/","content-type":"text/html; charset=UTF-8","content-security-policy-report-only":["object-src 'none';base-uri 'self';script-src 'nonce-w0if96oCu3EX7tRPyppOPg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp"],"date":"Sun, 04 Feb 2024 22:25:09 GMT","expires":"Tue, 05 Mar 2024 22:25:09 GMT","cache-control":["public","max-age=2592000"],"server":["gws"],"content-length":219,"x-xss-protection":"0","x-frame-options":"SAMEORIGIN","date_epoch_utc":1707085509,"expires_epoch_utc":1709677509},{"type":"request","request_method":"HEAD","request_uri":"/","request_version":"HTTP/1.1","host":"www.google.com","user-agent":"curl/8.1.2","accept":["*/*"]},{"type":"response","response_version":"HTTP/1.1","response_status":200,"response_reason":["OK"],"content-type":"text/html; charset=ISO-8859-1","content-security-policy-report-only":["object-src 'none';base-uri 'self';script-src 'nonce-NZmPRDFJDBUjfIdQ12Z3HA' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp"],"p3p":"CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"","date":"Sun, 04 Feb 2024 22:25:09 GMT","server":["gws"],"x-xss-protection":"0","x-frame-options":"SAMEORIGIN","transfer-encoding":["chunked"],"expires":"Sun, 04 Feb 2024 22:25:09 GMT","cache-control":["private"],"set-cookie":["1P_JAR=2024-02-04-22; expires=Tue, 05-Mar-2024 22:25:09 GMT; path=/; domain=.google.com; Secure","AEC=Ae3NU9Nm-_YoxvDgLc8KacFFXJ7YeR8_4xABOi_6TFPHkH3czLzKUMi2_eU; expires=Fri, 02-Aug-2024 22:25:09 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax","NID=511=D1Wo-3cLpM2WxRhuncNJmxkzx96hYr_1QWM5fVPzgPWf03fLZh_MfZEfA0YeSu443m6byeo7l0N9GqFJBxxGMghbMM9p89yQ6ELzgL9N4j31Ejjxj9BxFJ8ccmD794UlzMGAC3PKHTUDUpMRCJ9OOcgiJ8f67JE23iVrWFFkP2w; expires=Mon, 05-Aug-2024 22:25:09 GMT; path=/; domain=.google.com; HttpOnly"],"date_epoch_utc":1707085509,"expires_epoch_utc":1707085509}] diff --git a/tests/fixtures/generic/curl_head--ILvs-google-com.out b/tests/fixtures/generic/curl_head--ILvs-google-com.out new file mode 100644 index 00000000..e663ff9f --- /dev/null +++ b/tests/fixtures/generic/curl_head--ILvs-google-com.out @@ -0,0 +1,44 @@ +* Trying [2607:f8b0:4002:c11::71]:80... +* Connected to google.com (2607:f8b0:4002:c11::71) port 80 (#0) +> HEAD / HTTP/1.1 +> Host: google.com +> User-Agent: curl/8.1.2 +> Accept: */* +> +< HTTP/1.1 301 Moved Permanently +< Location: http://www.google.com/ +< Content-Type: text/html; charset=UTF-8 +< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-w0if96oCu3EX7tRPyppOPg' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp +< Date: Sun, 04 Feb 2024 22:25:09 GMT +< Expires: Tue, 05 Mar 2024 22:25:09 GMT +< Cache-Control: public, max-age=2592000 +< Server: gws +< Content-Length: 219 +< X-XSS-Protection: 0 +< X-Frame-Options: SAMEORIGIN +< +* Connection #0 to host google.com left intact +* Issue another request to this URL: 'http://www.google.com/' +* Trying [2607:f8b0:4002:c03::69]:80... +* Connected to www.google.com (2607:f8b0:4002:c03::69) port 80 (#1) +> HEAD / HTTP/1.1 +> Host: www.google.com +> User-Agent: curl/8.1.2 +> Accept: */* +> +< HTTP/1.1 200 OK +< Content-Type: text/html; charset=ISO-8859-1 +< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-NZmPRDFJDBUjfIdQ12Z3HA' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp +< P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info." +< Date: Sun, 04 Feb 2024 22:25:09 GMT +< Server: gws +< X-XSS-Protection: 0 +< X-Frame-Options: SAMEORIGIN +< Transfer-Encoding: chunked +< Expires: Sun, 04 Feb 2024 22:25:09 GMT +< Cache-Control: private +< Set-Cookie: 1P_JAR=2024-02-04-22; expires=Tue, 05-Mar-2024 22:25:09 GMT; path=/; domain=.google.com; Secure +< Set-Cookie: AEC=Ae3NU9Nm-_YoxvDgLc8KacFFXJ7YeR8_4xABOi_6TFPHkH3czLzKUMi2_eU; expires=Fri, 02-Aug-2024 22:25:09 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax +< Set-Cookie: NID=511=D1Wo-3cLpM2WxRhuncNJmxkzx96hYr_1QWM5fVPzgPWf03fLZh_MfZEfA0YeSu443m6byeo7l0N9GqFJBxxGMghbMM9p89yQ6ELzgL9N4j31Ejjxj9BxFJ8ccmD794UlzMGAC3PKHTUDUpMRCJ9OOcgiJ8f67JE23iVrWFFkP2w; expires=Mon, 05-Aug-2024 22:25:09 GMT; path=/; domain=.google.com; HttpOnly +< +* Connection #1 to host www.google.com left intact diff --git a/tests/fixtures/generic/http_headers--example-com.json b/tests/fixtures/generic/http_headers--example-com.json new file mode 100644 index 00000000..5e01c1a0 --- /dev/null +++ b/tests/fixtures/generic/http_headers--example-com.json @@ -0,0 +1 @@ +[{"type":"request","request_method":"HEAD","request_uri":"/","request_version":"HTTP/1.1","host":"example.com","user-agent":"curl/8.1.2","accept":["*/*"]},{"type":"response","response_version":"HTTP/1.1","response_status":200,"response_reason":["OK"],"accept-ranges":["bytes"],"age":140203,"cache-control":["max-age=604800"],"content-type":"text/html; charset=UTF-8","date":"Sun, 04 Feb 2024 02:25:07 GMT","etag":"\"3147526947\"","expires":"Sun, 11 Feb 2024 02:25:07 GMT","last-modified":"Thu, 17 Oct 2019 07:18:26 GMT","server":["ECS (sac/252F)"],"x-cache":"HIT","content-length":1256,"date_epoch_utc":1707013507,"expires_epoch_utc":1707618307,"last-modified_epoch_utc":1571296706}] diff --git a/tests/fixtures/generic/http_headers--example-com.out b/tests/fixtures/generic/http_headers--example-com.out new file mode 100644 index 00000000..ceb1ca5f --- /dev/null +++ b/tests/fixtures/generic/http_headers--example-com.out @@ -0,0 +1,18 @@ +HEAD / HTTP/1.1 +Host: example.com +User-Agent: curl/8.1.2 +Accept: */* + +HTTP/1.1 200 OK +Accept-Ranges: bytes +Age: 140203 +Cache-Control: max-age=604800 +Content-Type: text/html; charset=UTF-8 +Date: Sun, 04 Feb 2024 02:25:07 GMT +Etag: "3147526947" +Expires: Sun, 11 Feb 2024 02:25:07 GMT +Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT +Server: ECS (sac/252F) +X-Cache: HIT +Content-Length: 1256 + diff --git a/tests/fixtures/generic/http_headers--google-com.json b/tests/fixtures/generic/http_headers--google-com.json new file mode 100644 index 00000000..3153baec --- /dev/null +++ b/tests/fixtures/generic/http_headers--google-com.json @@ -0,0 +1 @@ +[{"type":"response","response_version":"HTTP/1.1","response_status":301,"response_reason":["Moved Permanently"],"location":"http://www.google.com/","content-type":"text/html; charset=UTF-8","content-security-policy-report-only":["object-src 'none';base-uri 'self';script-src 'nonce-hz60SAtf4llI3wIzHRfCJQ' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp"],"date":"Sun, 04 Feb 2024 22:48:38 GMT","expires":"Tue, 05 Mar 2024 22:48:38 GMT","cache-control":["public","max-age=2592000"],"server":["gws"],"content-length":219,"x-xss-protection":"0","x-frame-options":"SAMEORIGIN","date_epoch_utc":1707086918,"expires_epoch_utc":1709678918},{"type":"response","response_version":"HTTP/1.1","response_status":200,"response_reason":["OK"],"content-type":"text/html; charset=ISO-8859-1","content-security-policy-report-only":["object-src 'none';base-uri 'self';script-src 'nonce-mX7dt-8o5qVlNVsgmeavew' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp"],"p3p":"CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"","date":"Sun, 04 Feb 2024 22:48:38 GMT","server":["gws"],"x-xss-protection":"0","x-frame-options":"SAMEORIGIN","transfer-encoding":["chunked"],"expires":"Sun, 04 Feb 2024 22:48:38 GMT","cache-control":["private"],"set-cookie":["1P_JAR=2024-02-04-22; expires=Tue, 05-Mar-2024 22:48:38 GMT; path=/; domain=.google.com; Secure","AEC=Ae3NU9OU79owVo5-35hp-3J9oKndh-rfsAa-zY1qEjSYgasatkOvi9Cc_P8; expires=Fri, 02-Aug-2024 22:48:38 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax","NID=511=YT39CFpNgnJnUOS1bI2BM3RWycjJIJ9HfoYYzzj48nu9tym-Ja_uLvmg-vBYyJYoA7_BBrlj4nGil9o0WYbz2tfMwDVzpHXRVZTZx7P9yI-Ad9t8VgRB4wVS5nGEi9xZ20djOLr-bTWoIiJuXgUdKH30znpJXziu542KaHu0ZcQ; expires=Mon, 05-Aug-2024 22:48:38 GMT; path=/; domain=.google.com; HttpOnly"],"date_epoch_utc":1707086918,"expires_epoch_utc":1707086918}] diff --git a/tests/fixtures/generic/http_headers--google-com.out b/tests/fixtures/generic/http_headers--google-com.out new file mode 100644 index 00000000..4561a36c --- /dev/null +++ b/tests/fixtures/generic/http_headers--google-com.out @@ -0,0 +1,27 @@ +HTTP/1.1 301 Moved Permanently +Location: http://www.google.com/ +Content-Type: text/html; charset=UTF-8 +Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-hz60SAtf4llI3wIzHRfCJQ' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp +Date: Sun, 04 Feb 2024 22:48:38 GMT +Expires: Tue, 05 Mar 2024 22:48:38 GMT +Cache-Control: public, max-age=2592000 +Server: gws +Content-Length: 219 +X-XSS-Protection: 0 +X-Frame-Options: SAMEORIGIN + +HTTP/1.1 200 OK +Content-Type: text/html; charset=ISO-8859-1 +Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-mX7dt-8o5qVlNVsgmeavew' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp +P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info." +Date: Sun, 04 Feb 2024 22:48:38 GMT +Server: gws +X-XSS-Protection: 0 +X-Frame-Options: SAMEORIGIN +Transfer-Encoding: chunked +Expires: Sun, 04 Feb 2024 22:48:38 GMT +Cache-Control: private +Set-Cookie: 1P_JAR=2024-02-04-22; expires=Tue, 05-Mar-2024 22:48:38 GMT; path=/; domain=.google.com; Secure +Set-Cookie: AEC=Ae3NU9OU79owVo5-35hp-3J9oKndh-rfsAa-zY1qEjSYgasatkOvi9Cc_P8; expires=Fri, 02-Aug-2024 22:48:38 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax +Set-Cookie: NID=511=YT39CFpNgnJnUOS1bI2BM3RWycjJIJ9HfoYYzzj48nu9tym-Ja_uLvmg-vBYyJYoA7_BBrlj4nGil9o0WYbz2tfMwDVzpHXRVZTZx7P9yI-Ad9t8VgRB4wVS5nGEi9xZ20djOLr-bTWoIiJuXgUdKH30znpJXziu542KaHu0ZcQ; expires=Mon, 05-Aug-2024 22:48:38 GMT; path=/; domain=.google.com; HttpOnly + diff --git a/tests/test_curl_head.py b/tests/test_curl_head.py new file mode 100644 index 00000000..c6668abe --- /dev/null +++ b/tests/test_curl_head.py @@ -0,0 +1,27 @@ +import unittest +from tests import utils_for_test as test_utils + +# Execute these steps for standard tests: +# - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. +# - Organize fixtures in `tests/fixtures` for optimal structure. +# - Format fixtures as follows (using double dashes): +# - `{parser_name}--{some_test_description}.out` for command output. +# - `{parser_name}--{some_test_description}.json` for expected JSON after parsing. + +class MyTests(unittest.TestCase): + + def test_curl_head_nodata(self): + """ + Test 'curl_head' with no data + """ + test_utils.run_no_data(self, __file__, []) + + def test_curl_head_all_fixtures(self): + """ + Test 'curl_head' with various fixtures + """ + test_utils.run_all_fixtures(self, __file__) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_http_headers.py b/tests/test_http_headers.py new file mode 100644 index 00000000..25a2b4fd --- /dev/null +++ b/tests/test_http_headers.py @@ -0,0 +1,27 @@ +import unittest +from tests import utils_for_test as test_utils + +# Execute these steps for standard tests: +# - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. +# - Organize fixtures in `tests/fixtures` for optimal structure. +# - Format fixtures as follows (using double dashes): +# - `{parser_name}--{some_test_description}.out` for command output. +# - `{parser_name}--{some_test_description}.json` for expected JSON after parsing. + +class MyTests(unittest.TestCase): + + def test_http_headers_nodata(self): + """ + Test 'http_headers' with no data + """ + test_utils.run_no_data(self, __file__, []) + + def test_http_headers_all_fixtures(self): + """ + Test 'http_headers' with various fixtures + """ + test_utils.run_all_fixtures(self, __file__) + + +if __name__ == '__main__': + unittest.main()