finished block list endpoint for lan and added get data endpoint

This commit is contained in:
Kevin Froman 2020-03-19 01:44:44 -05:00
parent e90d7e96f4
commit d4f4487fb6
2 changed files with 16 additions and 1 deletions

View file

@ -2,11 +2,18 @@ import requests
from lan.getip import best_ip
from onionrblocks import insert, onionrblockapi
def test_lan_server(testmanager):
for i in range(1024, 65536):
try:
if requests.get(f"http://{best_ip}:{i}/ping").text == 'pong!':
bl = insert('test data')
if bl not in requests.get(f"http://{best_ip}:{i}/blist/0").text:
raise ValueError
if onionrblockapi.Block(bl).raw != requests.get(f"http://{best_ip}:{i}/get/{bl}").content:
raise ValueError
break
except requests.exceptions.ConnectionError:
pass