|
@@ 24-50 (lines=27) @@
|
| 21 |
|
from org_fedora_oscap import common |
| 22 |
|
|
| 23 |
|
|
| 24 |
|
def test_datastream_content_paths(): |
| 25 |
|
data = PolicyData() |
| 26 |
|
data.content_type = "datastream" |
| 27 |
|
data.content_url = "https://example.com/hardening.xml" |
| 28 |
|
data.datastream_id = "id_datastream_1" |
| 29 |
|
data.xccdf_id = "id_xccdf_new" |
| 30 |
|
data.content_path = "/usr/share/oscap/testing_ds.xml" |
| 31 |
|
data.cpe_path = "/usr/share/oscap/cpe.xml" |
| 32 |
|
data.tailoring_path = "/usr/share/oscap/tailoring.xml" |
| 33 |
|
data.profile_id = "Web Server" |
| 34 |
|
|
| 35 |
|
assert common.get_content_name(data) == "hardening.xml" |
| 36 |
|
|
| 37 |
|
expected_path = "/tmp/openscap_data/hardening.xml" |
| 38 |
|
assert common.get_raw_preinst_content_path(data) == expected_path |
| 39 |
|
|
| 40 |
|
expected_path = "/tmp/openscap_data/hardening.xml" |
| 41 |
|
assert common.get_preinst_content_path(data) == expected_path |
| 42 |
|
|
| 43 |
|
expected_path = "/root/openscap_data/hardening.xml" |
| 44 |
|
assert common.get_postinst_content_path(data) == expected_path |
| 45 |
|
|
| 46 |
|
expected_path = "/tmp/openscap_data/usr/share/oscap/tailoring.xml" |
| 47 |
|
assert common.get_preinst_tailoring_path(data) == expected_path |
| 48 |
|
|
| 49 |
|
expected_path = "/root/openscap_data/usr/share/oscap/tailoring.xml" |
| 50 |
|
assert common.get_postinst_tailoring_path(data) == expected_path |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
def test_archive_content_paths(): |
|
@@ 53-77 (lines=25) @@
|
| 50 |
|
assert common.get_postinst_tailoring_path(data) == expected_path |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
def test_archive_content_paths(): |
| 54 |
|
data = PolicyData() |
| 55 |
|
data.content_type = "archive" |
| 56 |
|
data.content_url = "http://example.com/oscap_content.tar" |
| 57 |
|
data.content_path = "oscap/xccdf.xml" |
| 58 |
|
data.profile_id = "Web Server" |
| 59 |
|
data.content_path = "oscap/xccdf.xml" |
| 60 |
|
data.tailoring_path = "oscap/tailoring.xml" |
| 61 |
|
|
| 62 |
|
assert common.get_content_name(data) == "oscap_content.tar" |
| 63 |
|
|
| 64 |
|
expected_path = "/tmp/openscap_data/oscap_content.tar" |
| 65 |
|
assert common.get_raw_preinst_content_path(data) == expected_path |
| 66 |
|
|
| 67 |
|
expected_path = "/tmp/openscap_data/oscap/xccdf.xml" |
| 68 |
|
assert common.get_preinst_content_path(data) == expected_path |
| 69 |
|
|
| 70 |
|
expected_path = "/root/openscap_data/oscap/xccdf.xml" |
| 71 |
|
assert common.get_postinst_content_path(data) == expected_path |
| 72 |
|
|
| 73 |
|
expected_path = "/tmp/openscap_data/oscap/tailoring.xml" |
| 74 |
|
assert common.get_preinst_tailoring_path(data) == expected_path |
| 75 |
|
|
| 76 |
|
expected_path = "/root/openscap_data/oscap/tailoring.xml" |
| 77 |
|
assert common.get_postinst_tailoring_path(data) == expected_path |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
def test_rpm_content_paths(): |
|
@@ 80-103 (lines=24) @@
|
| 77 |
|
assert common.get_postinst_tailoring_path(data) == expected_path |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
def test_rpm_content_paths(): |
| 81 |
|
data = PolicyData() |
| 82 |
|
data.content_type = "rpm" |
| 83 |
|
data.content_url = "http://example.com/oscap_content.rpm" |
| 84 |
|
data.profile_id = "Web Server" |
| 85 |
|
data.content_path = "/usr/share/oscap/xccdf.xml" |
| 86 |
|
data.tailoring_path = "/usr/share/oscap/tailoring.xml" |
| 87 |
|
|
| 88 |
|
assert common.get_content_name(data) == "oscap_content.rpm" |
| 89 |
|
|
| 90 |
|
expected_path = "/tmp/openscap_data/oscap_content.rpm" |
| 91 |
|
assert common.get_raw_preinst_content_path(data) == expected_path |
| 92 |
|
|
| 93 |
|
expected_path = "/tmp/openscap_data/usr/share/oscap/xccdf.xml" |
| 94 |
|
assert common.get_preinst_content_path(data) == expected_path |
| 95 |
|
|
| 96 |
|
expected_path = "/usr/share/oscap/xccdf.xml" |
| 97 |
|
assert common.get_postinst_content_path(data) == expected_path |
| 98 |
|
|
| 99 |
|
expected_path = "/tmp/openscap_data/usr/share/oscap/tailoring.xml" |
| 100 |
|
assert common.get_preinst_tailoring_path(data) == expected_path |
| 101 |
|
|
| 102 |
|
expected_path = "/usr/share/oscap/tailoring.xml" |
| 103 |
|
assert common.get_postinst_tailoring_path(data) == expected_path |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
def test_scap_security_guide_paths(): |