Repository: saltstack/salt (language: python)

Issue:
[BUG] Invlaid async_method on AsyncPubChannel
**Description**

https://github.com/saltstack/salt/blob/3006.x/salt/channel/client.py#L363

AsyncPubChannel defines `_decode_messages` in it's async_methods attribute. This should be `_decode_payload` instead.
A clear and concise description of what the bug is.


**Versions Report**

`3006.9`


Discussion / hints:

Fix patch:
diff --git a/changelog/66789.fixed.md b/changelog/66789.fixed.md
new file mode 100644
index 000000000000..f6d18c6247d4
--- /dev/null
+++ b/changelog/66789.fixed.md
@@ -0,0 +1,1 @@
+Fix bad async_method name on AsyncPubClient class
diff --git a/salt/channel/client.py b/salt/channel/client.py
index c60a41c063a5..12b3a08520d3 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",


Test patch:
diff --git a/tests/pytests/unit/channel/test_client.py b/tests/pytests/unit/channel/test_client.py
new file mode 100644
index 000000000000..783657c4a45e
--- /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)