diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-08-15 12:04:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-08-15 12:04:44 +0000 |
commit | 92fdafd73450b0e27e354f3225e84e00e5d0b6cd (patch) | |
tree | dca744bab83dd06aa43d691925d7dce34ed0b58e /tests/cli_tests/test_config.py | |
parent | Adding upstream version 1.12.0. (diff) | |
download | iredis-a6942afcf4bd15f818db40cbf1f7af923f2a8572.tar.xz iredis-a6942afcf4bd15f818db40cbf1f7af923f2a8572.zip |
Adding upstream version 1.12.1.upstream/1.12.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/cli_tests/test_config.py')
-rw-r--r-- | tests/cli_tests/test_config.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/cli_tests/test_config.py b/tests/cli_tests/test_config.py index 7d6839d..1795c62 100644 --- a/tests/cli_tests/test_config.py +++ b/tests/cli_tests/test_config.py @@ -23,3 +23,37 @@ def test_log_location_config(): content = logfile.read() assert len(content) > 100 + + +def test_load_prompt_from_config(iredis_client, clean_redis): + config_content = dedent( + """ + [main] + prompt = {host}abc{port}xx{db} + """ + ) + with open("/tmp/iredisrc", "w+") as etc_config: + etc_config.write(config_content) + + cli = pexpect.spawn("iredis -n 15 --iredisrc /tmp/iredisrc", timeout=1) + cli.expect("iredis") + cli.expect("127.0.0.1abc6379xx15") + cli.close() + + +def test_prompt_cli_overwrite_config(iredis_client, clean_redis): + config_content = dedent( + """ + [main] + prompt = {host}abc{port}xx{db} + """ + ) + with open("/tmp/iredisrc", "w+") as etc_config: + etc_config.write(config_content) + + cli = pexpect.spawn( + "iredis -n 15 --iredisrc /tmp/iredisrc --prompt='{db}-12345'", timeout=1 + ) + cli.expect("iredis") + cli.expect("15-12345") + cli.close() |