webstat-collector/tests/conftest.py

72 lines
1.6 KiB
Python
Raw Normal View History

import asyncio
import pytest
from chweb.config import create_config
from chweb.models import Check
@pytest.fixture()
def config():
config_dict = {
'kafka': {
'servers': ["localhost:9992"],
'topic': "sample",
2020-09-06 10:51:10 +02:00
'cafile': "/dev/null",
'cert': "/dev/null",
'key': "/dev/null",
'passwd': "",
},
'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",
2020-09-06 10:51:10 +02:00
'cafile': "",
'cert': "",
'key': "",
'passwd': "",
},
'postgres': {
'dbhost': "localhost",
'dbport': 5432,
'dbname': "chweb",
'dbuser': "vladan",
'dbpass': "",
2020-09-06 10:51:10 +02:00
'dbcert': "",
},
'sites': [{
'url': "https://dsadakjhkjsahkjh.com",
'regex': "domain",
'check_interval': 5,
},
]
}
return create_config(config_dict)
@pytest.fixture
def check():
return Check(
domain="example.com",
response_time=3265,
status=200,
url="https://example.com",
)