From e77a86e81e49a18746071f13f2f57b2f5e14f05f Mon Sep 17 00:00:00 2001 From: James Rouzier Date: Mon, 3 Feb 2025 11:47:05 -0500 Subject: [PATCH] Add unit test --- tests/unit/test_plugin_ssh.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_plugin_ssh.py b/tests/unit/test_plugin_ssh.py index 92471fde..216734da 100644 --- a/tests/unit/test_plugin_ssh.py +++ b/tests/unit/test_plugin_ssh.py @@ -187,11 +187,17 @@ def test_parse_target_address(): "ipv6": "c001:d00d::1337/128", } - test_namespace = argparse.Namespace(**{"6": False}) + test_namespace = argparse.Namespace(**{"6": False, "d": False}) address = plugin.parse_target_address(test_namespace, test_target) assert address == "123.123.123.123" + # Hack to work around invalid key + setattr(test_namespace, "d", True) + + address = plugin.parse_target_address(test_namespace, test_target) + assert address == "123-123-123-123.ip.linodeusercontent.com" + # Hack to work around invalid key setattr(test_namespace, "6", True)