def test_set_multi_propagate(mocker):
    Setting = mocker.patch('fossir.core.settings.proxy.Setting')
    SettingPrincipal = mocker.patch(
        'fossir.core.settings.proxy.SettingPrincipal')
    proxy = SettingsProxy('foo', {'reg': None}, acls={'acl'})
    proxy.set_multi({'reg': 'bar', 'acl': {'u'}})
    Setting.set_multi.assert_called_once_with('foo', {'reg': 'bar'})
    SettingPrincipal.set_acl_multi.assert_called_with('foo', {'acl': {'u'}})
def test_proxy_converters_all():
    epoch_dt = datetime(1970, 1, 1, tzinfo=pytz.utc)
    xmas_dt = datetime(2016, 12, 24, 20, tzinfo=pytz.utc)
    newyear_dt = datetime(2017, 1, 2, tzinfo=pytz.utc)
    duration = timedelta(days=2)
    defaults = {
        'epoch': epoch_dt,
        'xmas': None,
        'newyear': None,
        'duration': None
    }
    converters = {
        name: DatetimeConverter if name != 'duration' else TimedeltaConverter
        for name in defaults
    }
    proxy = SettingsProxy('test', defaults, converters=converters)
    proxy.set('xmas', xmas_dt)
    proxy.set_multi({'newyear': newyear_dt, 'duration': duration})
    assert proxy.get_all() == {
        'epoch': epoch_dt,
        'xmas': xmas_dt,
        'newyear': newyear_dt,
        'duration': duration
    }