From 002ab9103ceb292b618221d03730fbdaae5ec213 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 7 Aug 2024 16:07:42 -0700 Subject: [PATCH] Method name is _decode_payload not _decode_messages --- salt/channel/client.py | 2 +- tests/pytests/unit/channel/test_client.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/pytests/unit/channel/test_client.py diff --git a/salt/channel/client.py b/salt/channel/client.py index c60a41c063a..12b3a08520d 100644 --- a/salt/channel/client.py +++ b/salt/channel/client.py @@ -360,7 +360,7 @@ class AsyncPubChannel: async_methods = [ "connect", - "_decode_messages", + "_decode_payload", ] close_methods = [ "close", diff --git a/tests/pytests/unit/channel/test_client.py b/tests/pytests/unit/channel/test_client.py new file mode 100644 index 00000000000..783657c4a45 --- /dev/null +++ b/tests/pytests/unit/channel/test_client.py @@ -0,0 +1,19 @@ +import salt.channel.client + + +def test_async_methods(): + "Validate all defined async_methods and close_methods are present" + async_classes = [ + salt.channel.client.AsyncReqChannel, + salt.channel.client.AsyncPubChannel, + ] + method_attrs = [ + "async_methods", + "close_methods", + ] + for cls in async_classes: + for attr in method_attrs: + assert hasattr(cls, attr) + assert isinstance(getattr(cls, attr), list) + for name in getattr(cls, attr): + assert hasattr(cls, name)