tests/main.py

30 lines
653 B
Python

import socket
import urllib
from unittest import TestCase
from fixtures import device_mac, device_name, sensors
TCP_ADDR = ('127.0.0.1', 8283)
UDP_ADDR = ('127.0.0.1', 8283)
HTTP_URL = 'http://127.0.0.1:8080'
class TestTCP(TestCase):
def setUp(self) -> None:
self.sock = socket.socket()
self.sock.connect(TCP_ADDR)
def test_nm(self) -> None:
self.sock.sendall(b'') # TODO
self._wait_for_ok()
def test_json(self) -> None:
self.sock.sendall(b'') # TODO
self._wait_for_ok()
def _wait_for_ok(self) -> None:
data = self.sock.recv(1024)
self.assertEqual(data, b'OK')