forked from demisto/demisto-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
53 lines (38 loc) · 1.42 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
"""Configuring tests for the content suite
"""
import pytest
from _pytest.fixtures import FixtureRequest
from _pytest.tmpdir import TempPathFactory, _mk_tmp
from TestSuite.integration import Integration
from TestSuite.pack import Pack
from TestSuite.repo import Repo
# Helper Functions
def get_repo(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Repo:
tmp_dir = _mk_tmp(request, tmp_path_factory)
return Repo(tmp_dir)
def get_pack(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Pack:
"""Mocking tmp_path
"""
return get_repo(request, tmp_path_factory).create_pack()
def get_integration(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Integration:
"""Mocking tmp_path
"""
integration = get_pack(request, tmp_path_factory).create_integration()
integration.create_default_integration()
return integration
# Fixtures
@pytest.fixture
def pack(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Pack:
"""Mocking tmp_path
"""
return get_pack(request, tmp_path_factory)
@pytest.fixture
def integration(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Integration:
"""Mocking tmp_path
"""
return get_integration(request, tmp_path_factory)
@pytest.fixture
def repo(request: FixtureRequest, tmp_path_factory: TempPathFactory) -> Repo:
"""Mocking tmp_path
"""
return get_repo(request, tmp_path_factory)