File: test_profiles.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 (26 lines) | stat: -rw-r--r-- 798 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
22
23
24
25
26
import os

from ssg.products import get_profile_files_from_root
from ssg.profiles import (
    get_profiles_from_products,
    _load_product_yaml,
)


content_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "data/content_dir"))


def count_profiles_in_products_dir(product):
    product_yaml = _load_product_yaml(content_dir, product)
    profiles_files = get_profile_files_from_root(product_yaml, product_yaml)
    return len(profiles_files)


def test_get_profiles_from_products():
    products = ["rhel8"]
    profiles = get_profiles_from_products(content_dir, products, sorted=True)

    assert len(profiles) == count_profiles_in_products_dir(products[0])
    assert 'rhel' in profiles[0].product_id
    assert len(profiles[0].rules) > 0
    assert len(profiles[0].variables) > 0