mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 09:56:05 -05:00
[Config] Fix get() functionality (#815)
This commit is contained in:
@@ -18,7 +18,7 @@ def json_driver(tmpdir_factory):
|
||||
return driver
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@pytest.fixture()
|
||||
def config(json_driver):
|
||||
return Config(
|
||||
cog_name="PyTest",
|
||||
@@ -26,7 +26,7 @@ def config(json_driver):
|
||||
driver_spawn=json_driver)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@pytest.fixture()
|
||||
def config_fr(json_driver):
|
||||
"""
|
||||
Mocked config object with force_register enabled.
|
||||
|
||||
@@ -145,3 +145,18 @@ async def test_set_channel_no_register(config, empty_channel):
|
||||
await config.channel(empty_channel).set("no_register", True)
|
||||
assert config.channel(empty_channel).no_register() is True
|
||||
#endregion
|
||||
|
||||
|
||||
# region Getting Values
|
||||
def test_get_func_w_reg(config):
|
||||
config.register_global(
|
||||
thing=True
|
||||
)
|
||||
assert config.get("thing") is True
|
||||
assert config.get("thing", False) is False
|
||||
|
||||
|
||||
def test_get_func_wo_reg(config):
|
||||
assert config.get("thing") is None
|
||||
assert config.get("thing", True) is True
|
||||
# endregion
|
||||
|
||||
Reference in New Issue
Block a user