Skip to content
Snippets Groups Projects
Commit 2b06239b authored by Nico's avatar Nico
Browse files

Add unit tests

parent fa408b12
No related branches found
Tags 0.0.7
No related merge requests found
Pipeline #5943 failed
......@@ -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)
......
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