-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
conftest.py
78 lines (53 loc) · 1.61 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
# -*- coding: utf-8; -*-
# General libraries
from __future__ import division, print_function, absolute_import
# Third party libraries
import pytest
import requests
from heroku3.api import HerokuCore
from heroku3.models.configvars import ConfigVars
class __App:
def __init__(self):
self.name = "mock-application"
self.id = "12345678-90ab-cdef-1234-567890abcdef"
@pytest.fixture
def app():
return __App()
@pytest.fixture
def config_dict():
# Because the ``unit`` package will only be added to ``sys.path`` during
# discovery.
from unit.models.configvars import CONFIG_VAR_KEYS, CONFIG_VAR_VALUES
return dict(zip(CONFIG_VAR_KEYS, CONFIG_VAR_VALUES))
@pytest.fixture
def config_vars(config_dict, app, heroku_core):
# Not using new_from_dict() to not spoil coverage
cfg = ConfigVars(config_dict, app, h=heroku_core)
cfg.data = config_dict
cfg.app = app
return cfg
@pytest.fixture
def extra_config_dict():
# Because the ``unit`` package will only be added to ``sys.path`` during
# discovery.
from unit.models.configvars import (
EXTRA_CONFIG_VAR_KEYS,
EXTRA_CONFIG_VAR_VALUES,
)
return dict(zip(EXTRA_CONFIG_VAR_KEYS, EXTRA_CONFIG_VAR_VALUES))
@pytest.fixture
def heroku_api_key():
return "some-heroku-api-key"
@pytest.fixture
def heroku_core():
return HerokuCore()
@pytest.fixture
def heroku_core_w_session():
return HerokuCore(session=requests.session())
@pytest.fixture
def login_name():
return "some login name"
@pytest.fixture
def login_secret():
return "some login secret"
# vim: et:sw=4:syntax=python:ts=4: