Updated to 0.2.1
This commit is contained in:
@@ -14,11 +14,8 @@ from libbot import config_get, config_set
|
||||
(["bot_token", "bot"], "sample_token"),
|
||||
],
|
||||
)
|
||||
async def test_config_get_valid(args: List[str], expected: str):
|
||||
assert (
|
||||
await config_get(args[0], *args[1:], config_file=Path("tests/config.json"))
|
||||
== expected
|
||||
)
|
||||
async def test_config_get_valid(args: List[str], expected: str, location_config: Path):
|
||||
assert await config_get(args[0], *args[1:], config_file=location_config) == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -28,10 +25,12 @@ async def test_config_get_valid(args: List[str], expected: str):
|
||||
(["bot_stonks", "bot"], pytest.raises(KeyError)),
|
||||
],
|
||||
)
|
||||
async def test_config_get_invalid(args: List[str], expected: Any):
|
||||
async def test_config_get_invalid(
|
||||
args: List[str], expected: Any, location_config: Path
|
||||
):
|
||||
with expected:
|
||||
assert (
|
||||
await config_get(args[0], *args[1:], config_file=Path("tests/config.json"))
|
||||
await config_get(args[0], *args[1:], config_file=location_config)
|
||||
== expected
|
||||
)
|
||||
|
||||
@@ -44,6 +43,6 @@ async def test_config_get_invalid(args: List[str], expected: Any):
|
||||
("bot_token", ["bot"], "sample_token"),
|
||||
],
|
||||
)
|
||||
async def test_config_set(key: str, path: List[str], value: Any):
|
||||
await config_set(key, value, *path, config_file=Path("tests/config.json"))
|
||||
assert await config_get(key, *path, config_file=Path("tests/config.json")) == value
|
||||
async def test_config_set(key: str, path: List[str], value: Any, location_config: Path):
|
||||
await config_set(key, value, *path, config_file=location_config)
|
||||
assert await config_get(key, *path, config_file=location_config) == value
|
||||
|
Reference in New Issue
Block a user