выполненная лаб2

This commit is contained in:
2026-10-22 17:11:47 +03:00
parent 65003b6119
commit 508340638d
39 changed files with 3547 additions and 33 deletions
+20
View File
@@ -0,0 +1,20 @@
import sys,base64,uuid
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'tests'))
from client import Client,check
c=Client()
a,b,e,chat=c.bootstrap()
path='/api/v1/chats/'+chat['id']
results={'contract_extra':{}}
# Full UTF-8 password range, including a colon; malformed JSON and invalid limits.
unicode_name='utf_'+uuid.uuid4().hex[:16]
unicode_password='🔑'*120+':пароль!'
check(len(unicode_password)==128,'password fixture length')
c.call('POST','/api/v1/users',201,body={'username':unicode_name,'display_name':'UTF-8','password':unicode_password},schema='User')
credential=base64.b64encode((unicode_name+':'+unicode_password).encode()).decode()
c.call('POST','/api/v1/auth/sessions',201,headers={'Authorization':'Basic '+credential},schema='Session')
c.call('POST','/api/v1/users',400,raw=b'{',headers={'Content-Type':'application/json'})
c.call('GET',path+'/messages?limit='+('9'*100),400,actor=a)
results['contract_extra']['utf8_128_password_with_colon']=True
print('PASS: 128-codepoint UTF-8 password with colon; malformed JSON and oversized limit rejected')