diff --git a/tests/briar_wrapper/models/test_contacts.py b/tests/briar_wrapper/models/test_contacts.py index 20175657a8610c97aa175d4ad4e8c818461c3f1e..6a00d0ceb32e222af8950e4f6e370a9ad76b4778 100644 --- a/tests/briar_wrapper/models/test_contacts.py +++ b/tests/briar_wrapper/models/test_contacts.py @@ -14,6 +14,7 @@ BASE_HTTP_URL = "http://localhost:7000/v1/contacts/" TEST_ALIAS = "Alice" TEST_CONTACT_ID = 42 +TEST_PENDING_CONTACT_ID = "jsTgWcsEQ2g9rnomeK1g/hmO8M1Ix6ZIGWAjgBtlS9U=" TEST_CONTACT_FIRST = { "lastChatActivity": 1 @@ -50,6 +51,27 @@ def match_request_add_pending(request): return {"alias": TEST_ALIAS, "link": TEST_LINK} == request.json() +@requests_mock.Mocker(kw="requests_mock") +def test_add_pending_error(api, request_headers, requests_mock): + contacts = Contacts(api) + requests_mock.post(BASE_HTTP_URL + "add/pending/", status_code=400) + contacts.add_pending(TEST_LINK, TEST_ALIAS) + + +@requests_mock.Mocker(kw="requests_mock") +def test_delete_pending(api, request_headers, requests_mock): + contacts = Contacts(api) + requests_mock.register_uri("DELETE", + BASE_HTTP_URL + "add/pending/", + request_headers=request_headers, + additional_matcher=match_request_delete_pending) + contacts.delete_pending(TEST_PENDING_CONTACT_ID) + + +def match_request_delete_pending(request): + return {"pendingContactId": TEST_PENDING_CONTACT_ID} == request.json() + + @requests_mock.Mocker(kw="requests_mock") def test_set_alias(api, request_headers, requests_mock): contacts = Contacts(api)