Добавить панель системы и временный внешний доступ

This commit is contained in:
Никита
2026-11-10 11:25:50 +03:00
parent 0e0efe5614
commit a81c0bad34
19 changed files with 383 additions and 8 deletions
+14
View File
@@ -0,0 +1,14 @@
import sys,base64,http.client,json
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'tests'))
from client import Client,check
c=Client('http://localhost:18085');actor=c.user('chunked')
registration=actor['registration']
auth='Basic '+base64.b64encode((registration['username']+':'+registration['password']).encode()).decode()
for body,expected in (([],201),([b'x'],400)):
conn=http.client.HTTPConnection('localhost',18085,timeout=10)
conn.request('POST','/api/v1/auth/sessions',body=iter(body),headers={'Authorization':auth,'Transfer-Encoding':'chunked'},encode_chunked=True)
response=conn.getresponse();data=json.loads(response.read());conn.close()
check(response.status==expected,'chunked login status mismatch')
check(('token' in data) if expected==201 else data['error']['code']=='invalid_request','unexpected result')
print('PASS: empty chunked login accepted; nonempty chunked login rejected')