Add HTTP unittest with NarodMon format
This commit is contained in:
parent
c0d502369a
commit
b0b6d221a3
1 changed files with 19 additions and 1 deletions
20
main.py
20
main.py
|
@ -1,5 +1,5 @@
|
|||
import socket
|
||||
import urllib
|
||||
from urllib.request import urlopen, Request
|
||||
|
||||
from functools import partial
|
||||
from unittest import TestCase
|
||||
|
@ -38,3 +38,21 @@ class TestTCP(TestCase):
|
|||
def _wait_for_ok(self) -> None:
|
||||
data = self.sock.recv(1024)
|
||||
self.assertEqual(data, b'OK')
|
||||
|
||||
|
||||
class TestHTTP(TestCase):
|
||||
|
||||
def test_nm(self) -> None:
|
||||
req = Request(
|
||||
url=(HTTP_URL + '/get'),
|
||||
data=nm_req(),
|
||||
method='GET',
|
||||
)
|
||||
self._send_and_check(req)
|
||||
|
||||
def test_json(self) -> None:
|
||||
raise NotImplemented
|
||||
|
||||
def _send_and_check(self, req: Request) -> None:
|
||||
with urlopen(req) as resp:
|
||||
self.assertEqual(resp.status, 200)
|
||||
|
|
Loading…
Add table
Reference in a new issue