File: test_control_selector.py

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (21 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os

import pytest

from utils.oscal.control_selector import PolicyControlSelector

DATADIR = os.path.join(os.path.dirname(__file__), "data")
TEST_ROOT = os.path.abspath(os.path.join(DATADIR, "test_root"))
TEST_BUILD_CONFIG = os.path.join(DATADIR, "build-config.yml")


def test_control_selector_invalid_level() -> None:
    """Trigger an error when the level filter is invalid."""

    with pytest.raises(ValueError, match="Level fake not found in policy test_policy"):
        PolicyControlSelector(
            control="test_policy",
            ssg_root=TEST_ROOT,
            env_yaml=dict(),
            filter_by_level="fake",
        )