|
|
|
@ -20,13 +20,13 @@ def test_cache():
|
|
|
|
|
values = c.cfgimpl_get_values()
|
|
|
|
|
settings = c.cfgimpl_get_settings()
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u2
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert od1.u2 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u2 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u2' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u2' in settings._p_.get_cached('property', c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_cache_reset():
|
|
|
|
@ -36,44 +36,44 @@ def test_cache_reset():
|
|
|
|
|
settings = c.cfgimpl_get_settings()
|
|
|
|
|
#when change a value
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u2 = 1
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
#when remove a value
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
del(c.u2)
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
#when add/del property
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_get_settings()[od1.u2].append('test')
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_get_settings()[od1.u2].remove('test')
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
#when enable/disabled property
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_get_settings().append('test')
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_get_settings().remove('test')
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_cache_reset_multi():
|
|
|
|
@ -83,32 +83,32 @@ def test_cache_reset_multi():
|
|
|
|
|
settings = c.cfgimpl_get_settings()
|
|
|
|
|
#when change a value
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u3 = [1]
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
#when append value
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u3.append(1)
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
#when pop value
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u3.pop(1)
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
#when remove a value
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
del(c.u3)
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_reset_cache():
|
|
|
|
@ -117,23 +117,23 @@ def test_reset_cache():
|
|
|
|
|
values = c.cfgimpl_get_values()
|
|
|
|
|
settings = c.cfgimpl_get_settings()
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_reset_cache()
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u1
|
|
|
|
|
sleep(1)
|
|
|
|
|
c.u2
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert od1.u2 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u2 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u2' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u2' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_reset_cache()
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert od1.u2 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u2 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u2' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u2' not in settings._p_.get_cached('property', c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_reset_cache_only_expired():
|
|
|
|
@ -142,22 +142,22 @@ def test_reset_cache_only_expired():
|
|
|
|
|
values = c.cfgimpl_get_values()
|
|
|
|
|
settings = c.cfgimpl_get_settings()
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_reset_cache(True)
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
sleep(1)
|
|
|
|
|
c.u2
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert od1.u2 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u2 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u2' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u2' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_reset_cache(True)
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert od1.u2 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u2 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u2' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u2' in settings._p_.get_cached('property', c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_reset_cache_only():
|
|
|
|
@ -166,14 +166,14 @@ def test_reset_cache_only():
|
|
|
|
|
values = c.cfgimpl_get_values()
|
|
|
|
|
settings = c.cfgimpl_get_settings()
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_reset_cache(only=('values',))
|
|
|
|
|
assert od1.u1 not in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' not in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.u1
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' in settings._p_.get_cached('property', c)
|
|
|
|
|
c.cfgimpl_reset_cache(only=('settings',))
|
|
|
|
|
assert od1.u1 in values._p_.get_cached('value', c)
|
|
|
|
|
assert od1.u1 not in settings._p_.get_cached('property', c)
|
|
|
|
|
assert 'u1' in values._p_.get_cached('value', c)
|
|
|
|
|
assert 'u1' not in settings._p_.get_cached('property', c)
|
|
|
|
|