removed "PatchMalformedJsonMiddleware" because its not working on driver site

ref. oscar.krause/fastapi-dls#1
This commit is contained in:
Oscar Krause
2024-12-02 08:37:01 +01:00
parent 991a35ef1a
commit ea8a66d449
5 changed files with 0 additions and 105 deletions

View File

@@ -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 = {