Skip to content
Snippets Groups Projects
Commit 5c0683b5 authored by Nico's avatar Nico
Browse files

Add test for PrivateChat.mark_read

Should have added that in the MR already...
parent 31487a7f
No related branches found
No related tags found
1 merge request!15Add missing tests
......@@ -11,6 +11,7 @@ from briar_wrapper.models.private_chat import PrivateChat
BASE_HTTP_URL = "http://localhost:7000/v1/messages/%s"
TEST_CONTACT_ID = 42
TEST_MESSAGE_ID = "+AIMMgOCPFF8HDEhiEHYjbfKrg7v0G94inKxjvjYzA8="
TEST_TEXT = "Hello World"
......@@ -44,5 +45,19 @@ def test_delete_all_messages(api, request_headers, requests_mock):
private_chat.delete_all_messages()
@requests_mock.Mocker(kw="requests_mock")
def test_mark_read(api, request_headers, requests_mock):
private_chat = PrivateChat(api, TEST_CONTACT_ID)
url = BASE_HTTP_URL % f"{TEST_CONTACT_ID}/read"
requests_mock.register_uri("POST", url, request_headers=request_headers,
additional_matcher=match_request_mark_read)
private_chat.mark_read(TEST_MESSAGE_ID)
def match_request_send_message(request):
return {"text": TEST_TEXT} == request.json()
def match_request_mark_read(request):
return {"messageId": TEST_MESSAGE_ID} == request.json()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment