From 12ccadd9f9cd30143b3af6feced58f8da636e9d2 Mon Sep 17 00:00:00 2001 From: Evgeny Kolesnikov Date: Mon, 20 Jul 2020 07:45:05 +0200 Subject: [PATCH] Add test for cURL "Accept-Encoding" header --- tests/CMakeLists.txt | 1 + tests/curl/CMakeLists.txt | 1 + tests/curl/ds.xml | 99 ++++++++++++++++++++++++++++++++ tests/curl/test_curl_encoding.sh | 23 ++++++++ 4 files changed, 124 insertions(+) create mode 100644 tests/curl/CMakeLists.txt create mode 100644 tests/curl/ds.xml create mode 100755 tests/curl/test_curl_encoding.sh diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b7ca6cd79..6948cd260 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,6 +26,7 @@ add_subdirectory("API") add_subdirectory("bindings") add_subdirectory("bz2") add_subdirectory("codestyle") +add_subdirectory("curl") add_subdirectory("CPE") add_subdirectory("DS") add_subdirectory("mitre") diff --git a/tests/curl/CMakeLists.txt b/tests/curl/CMakeLists.txt new file mode 100644 index 000000000..9c3d90d74 --- /dev/null +++ b/tests/curl/CMakeLists.txt @@ -0,0 +1 @@ +add_oscap_test("test_curl_encoding.sh") diff --git a/tests/curl/ds.xml b/tests/curl/ds.xml new file mode 100644 index 000000000..f33cb475d --- /dev/null +++ b/tests/curl/ds.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + 5.11 + 2009-01-12T10:41:00-05:00 + + + + + + PASS + pass + + + + + + + + + + + + + + + + oval:x:var:1 + + + + + + 100 + + + + + + + + + accepted + 1.0 + + + xccdf_test_profile + This profile is for testing. + + + + + test value + foo + 50 + 100 + + + This rule always pass + + + + + + This rule checks remote resource + + + + + + This rule always pass + + + + + + + diff --git a/tests/curl/test_curl_encoding.sh b/tests/curl/test_curl_encoding.sh new file mode 100755 index 000000000..6d82f9569 --- /dev/null +++ b/tests/curl/test_curl_encoding.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e -o pipefail + +. $builddir/tests/test_common.sh + +function curl_accept_encoding { + local DF="${srcdir}/ds.xml" + local RF="results.xml" + local LOG="verbose.log" + + $OSCAP xccdf --verbose=DEVEL eval --fetch-remote-resources --results $RF $DF 2>$LOG || echo "OK" + + grep -P "Accept-Encoding.*gzip" $LOG + + return 0 +} + +test_init + +test_run "cURL: Accept-Encoding" curl_accept_encoding + +test_exit