Return bytes in models.create_*
This commit is contained in:
parent
86dc8777bc
commit
c0d502369a
2 changed files with 4 additions and 5 deletions
5
main.py
5
main.py
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Add table
Reference in a new issue