Commit 591a8d70 authored by Nico Alt's avatar Nico Alt

Add unit test for sending messages

parent c080a1f8
Pipeline #3567 canceled with stage
in 2 minutes and 45 seconds
......@@ -8,6 +8,7 @@ import requests_mock
from briar.api.models.private_chat import PrivateChat
SEND_TEXT = "Hello World"
......@@ -20,3 +21,18 @@ def test_get_empty(api, request_headers, requests_mock):
requests_mock.register_uri("GET", url, request_headers=request_headers,
assert private_chat.get(contact_id) == response
def test_send_message(api, request_headers, requests_mock):
private_chat = PrivateChat(api)
contact_id = 1
url = "http://localhost:7000/v1/messages/%s" % contact_id
requests_mock.register_uri("POST", url, request_headers=request_headers,
private_chat.send(contact_id, SEND_TEXT)
def match_request_text(request):
return {"text": SEND_TEXT} == request.json()
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment