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:
parent
f8514e782c
commit
c236039e0d
1 changed files with 2 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue