forked from mtusi2026/mtusi2026lab6
Лабораторная 6: наблюдаемость мессенджера
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""Verify durable handoff before a publisher or worker is enabled."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'tests'))
|
||||
from client import Client, arguments, check, run
|
||||
|
||||
|
||||
def main():
|
||||
args = arguments(__doc__)
|
||||
client = Client(args.base_url, args.ca_file)
|
||||
alice, bob, eve, chat = client.bootstrap()
|
||||
attachment, _ = client.attachment(alice, chat)
|
||||
path = '/api/v1/attachments/' + attachment['id']
|
||||
check(attachment['status'] == 'queued', 'expected queued with worker disabled')
|
||||
metadata = client.call('GET', path, actor=bob, schema='Attachment')['json']
|
||||
check(metadata == attachment, 'queued metadata differs')
|
||||
client.call('GET', path, 404, actor=eve)
|
||||
client.call('GET', path + '/content', 409, actor=bob)
|
||||
sent = client.message(alice, chat, '', attachments=[attachment['id']])['json']
|
||||
check(sent['attachment_ids'] == [attachment['id']], 'queued attachment not linked')
|
||||
print('PASS: 202 queued, metadata ACL, 409 before ready, and queued attachment linked')
|
||||
print('Attachment ID:', attachment['id'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run(main)
|
||||
Reference in New Issue
Block a user