mirror of
https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
synced 2025-11-02 09:46:04 +00:00
removed "PatchMalformedJsonMiddleware" because its not working on driver site
ref. oscar.krause/fastapi-dls#1
This commit is contained in:
23
test/main.py
23
test/main.py
@@ -18,7 +18,6 @@ sys.path.append('../app')
|
||||
from app import main
|
||||
from app.util import load_key
|
||||
|
||||
# main.app.add_middleware(PatchMalformedJsonMiddleware, enabled=True)
|
||||
client = TestClient(main.app)
|
||||
|
||||
ORIGIN_REF, ALLOTMENT_REF, SECRET = str(uuid4()), '20000000-0000-0000-0000-000000000001', 'HelloWorld'
|
||||
@@ -107,28 +106,6 @@ def test_auth_v1_origin():
|
||||
assert response.json().get('origin_ref') == ORIGIN_REF
|
||||
|
||||
|
||||
def test_auth_v1_origin_malformed_json(): # see oscar.krause/fastapi-dls#1
|
||||
from middleware import PatchMalformedJsonMiddleware
|
||||
|
||||
# test regex (temporary, until this section is merged into main.py
|
||||
s = '{"environment": {"fingerprint": {"mac_address_list": [ff:ff:ff:ff:ff:ff"]}}'
|
||||
replaced = PatchMalformedJsonMiddleware.fix_json(s)
|
||||
assert replaced == '{"environment": {"fingerprint": {"mac_address_list": ["ff:ff:ff:ff:ff:ff"]}}'
|
||||
|
||||
|
||||
def test_auth_v1_origin_middleware(): # see oscar.krause/fastapi-dls#1
|
||||
import json
|
||||
from middleware import PatchMalformedJsonMiddleware
|
||||
|
||||
# test regex (temporary, until this section is merged into main.py
|
||||
s = '{"environment": {"fingerprint": {"mac_address_list": ["aa:aa:aa:aa:aa:aa", "bb:bb:bb:bb:bb:bb"]}, "ip_address_list": ["127.0.0.1", "127.0.0.2"]}}'
|
||||
j = json.loads(s)
|
||||
PatchMalformedJsonMiddleware.fix_mac_address_list_length(j=j, size=1)
|
||||
PatchMalformedJsonMiddleware.fix_ip_address_list_length(j=j, size=1)
|
||||
s = json.dumps(j)
|
||||
assert s == '{"environment": {"fingerprint": {"mac_address_list": ["aa:aa:aa:aa:aa:aa"]}, "ip_address_list": ["127.0.0.1"]}}'
|
||||
|
||||
|
||||
|
||||
def auth_v1_origin_update():
|
||||
payload = {
|
||||
|
||||
Reference in New Issue
Block a user