Add UDP socket tests

This commit is contained in:
DarkCat09 2024-05-31 19:27:07 +04:00
parent 29d49dfeb2
commit 116ee89390
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

15
main.py
View file

@ -33,6 +33,21 @@ class TestTCP(TestCase):
self.sock.close() self.sock.close()
class TestUDP(TestCase):
def setUp(self) -> None:
self.sock = socket.socket(type=socket.SOCK_DGRAM)
def test_nm(self) -> None:
self.sock.sendto(device.nm_req_data().encode(), UDP_ADDR)
# aaand we can not check if server accepted the data
# so this TestCase is absolutely useless
# until client API is implemented
def test_json(self) -> None:
self.sock.sendto(device.json_req_data().encode(), UDP_ADDR)
class TestHTTP(TestCase): class TestHTTP(TestCase):
def test_get(self) -> None: def test_get(self) -> None: