summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-05-16 21:04:55 -0400
committerJeff Forcier <jeff@bitprophet.org>2023-05-18 13:57:19 -0400
commit41ce1ac25928a647e819d11e181d788d4a495c5a (patch)
tree1ccdf9451fbe43ec19b02a004d2f41f1bd5e3bb1 /tests
parentfeb48c3792f1c54d189d04cd66364e5728ffe6bd (diff)
Implement _fields on AgentKey so __eq__ works correctly
Diffstat (limited to 'tests')
-rw-r--r--tests/agent.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/agent.py b/tests/agent.py
new file mode 100644
index 00000000..18ece7a9
--- /dev/null
+++ b/tests/agent.py
@@ -0,0 +1,24 @@
+from paramiko import AgentKey
+
+
+class AgentKey_:
+ class fields:
+ """
+ _fields
+ """
+
+ def defaults_to_get_name_and_blob(self):
+ # Manually construct a 'failed to get inner_key' obj
+ class FallbackAgentKey(AgentKey):
+ def __init__(self, name, blob):
+ self.name = name
+ self.blob = blob
+ self.inner_key = None
+
+ key = FallbackAgentKey(name="lol", blob=b"lmao")
+ assert key._fields == ["lol", b"lmao"]
+
+ def defers_to_inner_key_when_present(self, keys):
+ key = AgentKey(agent=None, blob=keys.pkey.asbytes())
+ assert key._fields == keys.pkey._fields
+ assert key == keys.pkey