-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_sync_messages.py
More file actions
38 lines (21 loc) · 1.27 KB
/
test_sync_messages.py
File metadata and controls
38 lines (21 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest
from mpt_api_client.exceptions import MPTAPIError
pytestmark = [pytest.mark.flaky]
def test_list_chat_messages(chat_messages_service):
result = chat_messages_service.fetch_page(limit=1)
assert len(result) > 0
def test_create_chat_message(created_chat_message, chat_message_data): # noqa: AAA01
assert created_chat_message.id is not None
assert created_chat_message.to_dict().get("content") == chat_message_data["content"]
def test_update_chat_message_visibility(chat_messages_service, created_chat_message):
result = chat_messages_service.update(created_chat_message.id, {"visibility": "Public"})
assert result.id == created_chat_message.id
def test_delete_chat_message(chat_messages_service, created_chat_message):
result = created_chat_message
chat_messages_service.delete(result.id)
def test_update_chat_message_not_found(chat_messages_service, invalid_chat_message_id):
with pytest.raises(MPTAPIError, match=r"404 Not Found"):
chat_messages_service.update(invalid_chat_message_id, {"visibility": "Public"})
def test_delete_chat_message_not_found(chat_messages_service, invalid_chat_message_id):
with pytest.raises(MPTAPIError, match=r"404 Not Found"):
chat_messages_service.delete(invalid_chat_message_id)