| Total Complexity | 1 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |