Completed
Push — rhel9-branch ( cf5a6a...b257de )
by Jan
15s queued 12s
created

test_content_handling.test_get_profiles()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
import os
2
import glob
3
4
import pytest
5
6
from org_fedora_oscap import content_handling as ch
7
8
9
TESTING_FILES_PATH = os.path.join(
10
    os.path.dirname(__file__), os.path.pardir, "testing_files")
11
DS_FILEPATH = os.path.join(
12
    TESTING_FILES_PATH, "testing_ds.xml")
13
14
DS_IDS = "scap_org.open-scap_datastream_tst"
15
CHK_FIRST_ID = "scap_org.open-scap_cref_first-xccdf.xml"
16
CHK_SECOND_ID = "scap_org.open-scap_cref_second-xccdf.xml"
17
18
PROFILE1_ID = "xccdf_com.example_profile_my_profile"
19
PROFILE2_ID = "xccdf_com.example_profile_my_profile2"
20
PROFILE3_ID = "xccdf_com.example_profile_my_profile3"
21
22
23
def test_identify_files():
24
    filenames = glob.glob(TESTING_FILES_PATH + "/*")
25
    identified = ch.identify_files(filenames)
26
    assert identified[DS_FILEPATH] == ch.CONTENT_TYPES["DATASTREAM"]
27
    assert identified[
28
        os.path.join(TESTING_FILES_PATH, "scap-mycheck-oval.xml")] == ch.CONTENT_TYPES["OVAL"]
29
    assert identified[
30
        os.path.join(TESTING_FILES_PATH, "tailoring.xml")] == ch.CONTENT_TYPES["TAILORING"]
31
    assert identified[
32
        os.path.join(TESTING_FILES_PATH, "testing_xccdf.xml")] == ch.CONTENT_TYPES["XCCDF_CHECKLIST"]
33
    assert identified[
34
        os.path.join(TESTING_FILES_PATH, "cpe-dict.xml")] == ch.CONTENT_TYPES["CPE_DICT"]
35