summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-20 09:32:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-20 09:32:29 +0000
commit014c400849f01582f958e1a729ce239ffd7b2268 (patch)
treee30eac025e81b68a50ad7d167270bda28ee3ce21 /tests
parentReleasing debian version 1.14.0-1. (diff)
downloadiredis-014c400849f01582f958e1a729ce239ffd7b2268.tar.xz
iredis-014c400849f01582f958e1a729ce239ffd7b2268.zip
Merging upstream version 1.14.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/cli_tests/test_config.py2
-rw-r--r--tests/cli_tests/test_history.py4
-rw-r--r--tests/cli_tests/test_pager.py4
-rw-r--r--tests/conftest.py2
-rw-r--r--tests/unittests/test_entry.py13
-rw-r--r--tests/unittests/test_utils.py1
6 files changed, 20 insertions, 6 deletions
diff --git a/tests/cli_tests/test_config.py b/tests/cli_tests/test_config.py
index 1795c62..eeaba33 100644
--- a/tests/cli_tests/test_config.py
+++ b/tests/cli_tests/test_config.py
@@ -19,7 +19,7 @@ def test_log_location_config():
log = Path("/tmp/iredis1.log")
assert log.exists()
- with open(log, "r") as logfile:
+ with open(log) as logfile:
content = logfile.read()
assert len(content) > 100
diff --git a/tests/cli_tests/test_history.py b/tests/cli_tests/test_history.py
index 09e6c82..acb25d3 100644
--- a/tests/cli_tests/test_history.py
+++ b/tests/cli_tests/test_history.py
@@ -10,7 +10,7 @@ def test_history_not_log_auth(cli):
cli.sendline("set foo bar")
cli.expect("OK")
- with open(os.path.expanduser("~/.iredis_history"), "r") as history_file:
+ with open(os.path.expanduser("~/.iredis_history")) as history_file:
content = history_file.read()
assert "set foo bar" in content
@@ -36,7 +36,7 @@ def test_history_create_and_writing_with_config():
log = Path("/tmp/iredis_history.txt")
assert log.exists()
- with open(log, "r") as logfile:
+ with open(log) as logfile:
content = logfile.read()
assert "set hello world" in content
diff --git a/tests/cli_tests/test_pager.py b/tests/cli_tests/test_pager.py
index c3f9fb0..e8106a4 100644
--- a/tests/cli_tests/test_pager.py
+++ b/tests/cli_tests/test_pager.py
@@ -13,12 +13,12 @@ TEST_IREDISRC = "/tmp/.iredisrc.test"
TEST_PAGER_BOUNDARY = "---boundary---"
TEST_PAGER_BOUNDARY_NUMBER = "---88938347271---"
-env_pager = "{0} {1} {2}".format(
+env_pager = "{} {} {}".format(
sys.executable,
os.path.join(pathlib.Path(__file__).parent, "wrappager.py"),
TEST_PAGER_BOUNDARY,
)
-env_pager_numbers = "{0} {1} {2}".format(
+env_pager_numbers = "{} {} {}".format(
sys.executable,
os.path.join(pathlib.Path(__file__).parent, "wrappager.py"),
TEST_PAGER_BOUNDARY_NUMBER,
diff --git a/tests/conftest.py b/tests/conftest.py
index 593e8a8..42840e3 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -53,7 +53,7 @@ def judge_command():
return
variables = m.variables()
- print("Found variables: {}".format(variables))
+ print(f"Found variables: {variables}")
for expect_token, expect_value in expect.items():
all_variables = variables.getall(expect_token)
if len(all_variables) > 1:
diff --git a/tests/unittests/test_entry.py b/tests/unittests/test_entry.py
index e53861e..99d6931 100644
--- a/tests/unittests/test_entry.py
+++ b/tests/unittests/test_entry.py
@@ -175,6 +175,19 @@ def test_command_shell_options_higher_priority():
),
),
(
+ "redis://username:pass@word@localhost:12345/2",
+ DSN(
+ scheme="redis",
+ host="localhost",
+ port=12345,
+ path=None,
+ db=2,
+ username="username",
+ password="pass@word",
+ verify_ssl=None,
+ ),
+ ),
+ (
"redis://username@localhost:12345",
DSN(
scheme="redis",
diff --git a/tests/unittests/test_utils.py b/tests/unittests/test_utils.py
index 98ea8db..e00eaff 100644
--- a/tests/unittests/test_utils.py
+++ b/tests/unittests/test_utils.py
@@ -55,6 +55,7 @@ def test_timer():
(r'""', [""]), # set foo "" is a legal command
(r"\\", ["\\\\"]), # backslash are legal
("\\hello\\", ["\\hello\\"]), # backslash are legal
+ ('foo "bar\\n1"', ["foo", "bar\n1"]),
],
)
def test_stripe_quote_escape_in_quote(test_input, expected):