Move configuration code to its own module
This commit is contained in:
parent
eee471e9a7
commit
189681c5fa
3 changed files with 97 additions and 89 deletions
|
@ -1,54 +1,57 @@
|
|||
import asyncio
|
||||
import pytest
|
||||
from chweb.cmd import create_config
|
||||
from chweb.config import create_config
|
||||
from chweb.models import Check
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def config():
|
||||
config_dict = {
|
||||
'kafka': {
|
||||
'servers': ["localhost:9992"],
|
||||
'topic': "sample",
|
||||
},
|
||||
'postgres': {
|
||||
'dbhost': "localhost",
|
||||
'dbport': 5432,
|
||||
'dbname': "chweb",
|
||||
'dbuser': "vladan",
|
||||
'dbpass': "",
|
||||
},
|
||||
'sites': [{
|
||||
'url': "https://example.com",
|
||||
'regex': "aaaaaaaaaaaaa",
|
||||
'check_interval': 8,
|
||||
'kafka': {
|
||||
'servers': ["localhost:9992"],
|
||||
'topic': "sample",
|
||||
},
|
||||
]
|
||||
'postgres': {
|
||||
'dbhost': "localhost",
|
||||
'dbport': 5432,
|
||||
'dbname': "chweb",
|
||||
'dbuser': "vladan",
|
||||
'dbpass': "",
|
||||
},
|
||||
'sites': [{
|
||||
'url': "https://example.com",
|
||||
'regex': "aaaaaaaaaaaaa",
|
||||
'check_interval': 8,
|
||||
},
|
||||
]
|
||||
}
|
||||
return create_config(config_dict)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config_invalid():
|
||||
config_dict = {
|
||||
'kafka': {
|
||||
'servers': ["localhost:9992"],
|
||||
'topic': "sample",
|
||||
},
|
||||
'postgres': {
|
||||
'dbhost': "localhost",
|
||||
'dbport': 5432,
|
||||
'dbname': "chweb",
|
||||
'dbuser': "vladan",
|
||||
'dbpass': "",
|
||||
},
|
||||
'sites': [{
|
||||
'url': "https://dsadakjhkjsahkjh.com",
|
||||
'regex': "domain",
|
||||
'check_interval': 5,
|
||||
'kafka': {
|
||||
'servers': ["localhost:9992"],
|
||||
'topic': "sample",
|
||||
},
|
||||
]
|
||||
'postgres': {
|
||||
'dbhost': "localhost",
|
||||
'dbport': 5432,
|
||||
'dbname': "chweb",
|
||||
'dbuser': "vladan",
|
||||
'dbpass': "",
|
||||
},
|
||||
'sites': [{
|
||||
'url': "https://dsadakjhkjsahkjh.com",
|
||||
'regex': "domain",
|
||||
'check_interval': 5,
|
||||
},
|
||||
]
|
||||
}
|
||||
return create_config(config_dict)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check():
|
||||
return Check(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue