mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 09:56:05 -05:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user