Debian Codegraph @

tests/API/XCCDF/unittests/test_remediate_python.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 . $builddir/tests/test_common.sh
3
4 set -e
5 set -o pipefail
6
7 name=$(basenamescip-shell system . . basename. $0 .sh)
8 stderr=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX)
9 result=$(mktempscip-shell system . . mktemp. -t ${name}.out.XXXXXX)
10 echoscip-shell system . . echo. "Stderr file = $stderr"
11 echoscip-shell system . . echo. "Result file = $stderr"
12 rmscip-shell system . . rm. -f test_file
13
14 $OSCAP xccdf remediate --results $result $srcdir/${name}.xccdf.xml 2> $stderr
15 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr
16 [scip-shell system . . `[`. -f test_file ]; rmscip-shell system . . rm. test_file
17 $OSCAP xccdf validate --skip-schematron $result
18 assert_exists 2 '//TestResult'
19 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]'
20 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]/rule-result'
21 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]/rule-result/result'
22 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]/rule-result/result[text()="fixed"]'
23 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]/rule-result/fix'
24 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]/rule-result/message'
25 assert_exists 1 '//TestResult[@id="xccdf_org.open-scap_testresult_default-profile001"]/rule-result/message[text()="Fix execution completed and returned: 0"]'
26
27 rmscip-shell system . . rm. $result