[V3 Config] Adjust functionality of get_attr (#1342)

* Intermediate commit

* Add defaulting stuff to config

* Remove set_attr in favor of set_raw

* Modify get_attr

* Fix issue with clearing data
This commit is contained in:
Will
2018-02-26 15:13:01 -05:00
committed by palmtree5
parent c428982c00
commit 64af7800dc
5 changed files with 54 additions and 81 deletions

View File

@@ -219,14 +219,14 @@ async def test_set_channel_no_register(config, empty_channel):
# Dynamic attribute testing
@pytest.mark.asyncio
async def test_set_dynamic_attr(config):
await config.set_attr("foobar", True)
await config.set_raw("foobar", value=True)
assert await config.foobar() is True
@pytest.mark.asyncio
async def test_get_dynamic_attr(config):
assert await config.get_attr("foobaz", True) is True
assert await config.get_raw("foobaz", default=True) is True
# Member Group testing
@@ -299,13 +299,12 @@ async def test_member_clear_all(config, member_factory):
@pytest.mark.asyncio
async def test_clear_value(config_fr):
config_fr.register_global(foo=False)
await config_fr.foo.set(True)
await config_fr.foo.clear()
async def test_clear_value(config):
await config.foo.set(True)
await config.foo.clear()
with pytest.raises(KeyError):
await config_fr.get_raw('foo')
await config.get_raw('foo')
# Get All testing