async def test_config(event_loop): async with base.CleanModel() as model: await model.set_config({ 'extra-info': 'booyah', 'test-mode': ConfigValue(value=True), }) result = await model.get_config() assert 'extra-info' in result assert result['extra-info'].source == 'model' assert result['extra-info'].value == 'booyah'
async def test_config_with_json(event_loop): async with base.CleanModel() as model: # first test get_config with nothing. result = await model.get_config() assert 'extra-complex-info' not in result # test model config with more complex data expected = ['foo', {'bar': 1}] await model.set_config({ 'extra-complex-info': json.dumps(expected), 'test-mode': ConfigValue(value=True), }) result = await model.get_config() assert 'extra-complex-info' in result assert result['extra-complex-info'].source == 'model' recieved = json.loads(result['extra-complex-info'].value) assert recieved == recieved