tiramisu/tests/config.py

43 lines
1023 B
Python
Raw Normal View History

# from json import dumps, loads
try:
2019-08-03 21:03:23 +02:00
from tiramisu_api import Config
class TestConfig(Config):
def __init__(self,
config):
self.test_option = config.option
json = self.test_option.dict()
# assert json == loads(dumps(json))
super().__init__(json)
def send_data(self,
updates):
return self.updates_data(self.test_option.updates(updates))
PARAMS = ['tiramisu', 'tiramisu-api']
except:
PARAMS = ['tiramisu']
import pytest
2019-12-24 15:24:20 +01:00
async def get_config(config, type, error=False):
if type == 'tiramisu':
return config
if error:
2019-12-24 15:24:20 +01:00
await config.property.add('demoting_error_warning')
return TestConfig(config)
def value_list(values):
if values[0] == '':
del values[0]
return tuple(values)
2019-12-24 15:24:20 +01:00
async def global_owner(config, config_type):
return await config.owner.get()
@pytest.fixture(params=PARAMS)
def config_type(request):
return request.param