aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/cc/conftest.py
blob: 12fbc2db1aa9a9a69185cba15526e3a5dd8f42c1 (plain) (blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from collections.abc import Generator
from datetime import date
from importlib import resources
from pathlib import Path

import pytest
import tests.data.cc.analysis
import tests.data.cc.dataset
import tests.data.protection_profiles

from sec_certs.dataset.cc import CCDataset
from sec_certs.dataset.protection_profile import ProtectionProfileDataset
from sec_certs.sample.cc import CCCertificate


@pytest.fixture(scope="module")
def pp_data_dir() -> Generator[Path, None, None]:
    with resources.path(tests.data.protection_profiles, "") as path:
        yield path


@pytest.fixture(scope="module")
def data_dir() -> Generator[Path, None, None]:
    with resources.path(tests.data.cc.dataset, "") as path:
        yield path


@pytest.fixture(scope="module")
def analysis_data_dir() -> Generator[Path, None, None]:
    with resources.path(tests.data.cc.analysis, "") as path:
        yield path


@pytest.fixture
def toy_dataset() -> CCDataset:
    with resources.path(tests.data.cc.dataset, "toy_dataset.json") as path:
        return CCDataset.from_json(path)


@pytest.fixture
def toy_pp_dataset() -> ProtectionProfileDataset:
    with resources.path(tests.data.protection_profiles, "dataset.json") as path:
        return ProtectionProfileDataset.from_json(path)


@pytest.fixture
def cert_one() -> CCCertificate:
    return CCCertificate(
        "active",
        "Access Control Devices and Systems",
        "NetIQ Identity Manager 4.7",
        "NetIQ Corporation",
        "SE",
        {"ALC_FLR.2", "EAL3+"},
        date(2020, 6, 15),
        date(2025, 6, 15),
        "https://www.commoncriteriaportal.org/nfs/ccpfiles/files/epfiles/Certification%20Report%20-%20NetIQ®%20Identity%20Manager%204.7.pdf",
        "https://www.commoncriteriaportal.org/nfs/ccpfiles/files/epfiles/ST%20-%20NetIQ%20Identity%20Manager%204.7.pdf",
        "https://www.commoncriteriaportal.org/nfs/ccpfiles/files/epfiles/Certifikat%20CCRA%20-%20NetIQ%20Identity%20Manager%204.7_signed.pdf",
        "https://www.netiq.com/",
        None,
        set(),
        None,
        None,
        None,
    )


@pytest.fixture(scope="module")
def cert_two() -> CCCertificate:
    update = CCCertificate.MaintenanceReport(
        date(1900, 1, 1), "Sample maintenance", "https://maintenance.up", "https://maintenance.up"
    )

    return CCCertificate(
        "archived",
        "Access Control Devices and Systems",
        "Sample certificate name",
        "Sample manufacturer",
        "DE",
        {"Sample security level"},
        date(1900, 1, 2),
        date(1900, 1, 3),
        "https://path.to/report/link",
        "https://path.to/st/link",
        "https://path.to/cert/link",
        "https://path.to/manufacturer/web",
        {"https://sample.pp"},
        {update},
        None,
        None,
        None,
    )