Return bytes in models.create_*

This commit is contained in:
DarkCat09 2024-05-31 16:20:25 +04:00
parent 86dc8777bc
commit c0d502369a
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3
2 changed files with 4 additions and 5 deletions

View file

@ -29,12 +29,11 @@ class TestTCP(TestCase):
self.sock.connect(TCP_ADDR)
def test_nm(self) -> None:
self.sock.sendall(nm_req().encode('utf-8'))
self.sock.sendall(nm_req())
self._wait_for_ok()
def test_json(self) -> None:
self.sock.sendall(b'') # TODO
self._wait_for_ok()
raise NotImplemented
def _wait_for_ok(self) -> None:
data = self.sock.recv(1024)

View file

@ -13,7 +13,7 @@ class SensorData:
def create_nm_req(
dev_mac: str,
dev_name: str | None = None,
sensors: Iterable[SensorData] = ()) -> str:
sensors: Iterable[SensorData] = ()) -> bytes:
'''Generate a NarodMon format (#mac#value) request'''
res = '#' + dev_mac
@ -29,4 +29,4 @@ def create_nm_req(
res += '#' + s.name
res += '\n'
return res
return res.encode('utf-8')