-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
90 lines (68 loc) · 2.33 KB
/
conftest.py
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
import os
from datetime import datetime, timedelta
import pytest
from maintainer import (
DEPRECATION_DAYS_LIMIT,
GithubProvider,
RegistryStack,
RegistryStackMaintainer,
get_YAML,
)
@pytest.fixture(scope="session")
def acceptable_yaml():
yield open("tests/resources/check_dumper.yaml").read()
@pytest.fixture(scope="session")
def test_yaml_dict():
yield {"testblock": ["testvalue"]}
@pytest.fixture(scope="session")
def owners_content():
yield "reviewers:\n - maintainer"
@pytest.fixture(scope="session")
def test_registry_stack(owners_content: str):
yield RegistryStack(
path="stacks/test-stack/1.1.0/devfile.yaml",
raw_content="metadata:\n title: test-stack\n tags:\n - tag",
last_modified="Sun, 03 Mar 2024 22:01:01 GMT",
file_sha="somesha",
owners_content=owners_content,
)
@pytest.fixture(scope="session")
def test_expired_non_deprecated_registry_stack(owners_content: str):
yield RegistryStack(
path="stacks/test-stack/1.2.0/devfile.yaml",
raw_content="metadata:\n title: test-stack\n tags:\n - tag",
last_modified="Sun, 03 Mar 2022 22:01:01 GMT",
file_sha="somesha",
owners_content=owners_content,
)
@pytest.fixture(scope="session")
def test_deprecated_registry_stack(owners_content: str):
yield RegistryStack(
path="stacks/test-stack/1.1.0/devfile.yaml",
raw_content="metadata:\n title: test-stack\n tags:\n - Deprecated",
last_modified=datetime.strftime(
(datetime.now() - timedelta(days=DEPRECATION_DAYS_LIMIT)),
"%a, %d %b %Y %H:%M:%S GMT",
),
file_sha="somesha",
owners_content=owners_content,
)
@pytest.fixture(scope="session")
def test_registry_stack_no_owners():
yield RegistryStack(
path="stacks/test-stack/1.1.0/devfile.yaml",
raw_content="metadata:\n title: test-stack\n tags:\n - tag",
last_modified="Sun, 03 Mar 2024 22:01:01 GMT",
file_sha="somesha",
owners_content=None,
)
@pytest.fixture(scope="session")
def github_provider():
os.environ["TEST_MODE"] = "1"
yield GithubProvider(token="test-token")
@pytest.fixture(scope="session")
def yaml_provider():
yield get_YAML()
@pytest.fixture(scope="session")
def registry_stack_maintainer():
yield RegistryStackMaintainer()