test/api: use high level message dispatcher

Use the new `BaseAPI._message` high level message dispatcher that
is more convenient to use.
This commit is contained in:
Christian Kellner 2020-07-24 20:05:48 +02:00 committed by Tom Gundersen
parent f8514e782c
commit c236039e0d

View file

@ -19,13 +19,12 @@ class APITester(osbuild.api.BaseAPI):
endpoint = "test-api"
def _dispatch(self, server):
msg, _, addr = server.recv()
def _message(self, msg, _fds, sock, addr):
self.messages += 1
if msg["method"] == "echo":
msg["method"] = "reply"
server.send(msg, destination=addr)
sock.send(msg, destination=addr)
def _cleanup(self):
self.clean = True