From dedbbd637c1195ae84876b9555e6f94327ea38fe Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Sun, 11 Oct 2020 16:00:01 +0000
Subject: [PATCH] Finalize support

---
 briar_wrapper/models/contacts.py            | 3 ++-
 tests/briar_wrapper/models/test_contacts.py | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/briar_wrapper/models/contacts.py b/briar_wrapper/models/contacts.py
index 63005d5..0438275 100644
--- a/briar_wrapper/models/contacts.py
+++ b/briar_wrapper/models/contacts.py
@@ -38,13 +38,14 @@ class Contacts(Model):
         _post(url, headers=self._headers, json={"link": link, "alias": alias})
 
     def set_alias(self, contact_id: int, alias: str) -> None:
+        # pylint: disable=line-too-long
         """
         Sets the alias of a given user
 
         [Upstream documentation](https://code.briarproject.org/briar/briar/-/blob/main/briar-headless/README.md#changing-alias-of-a-contact)
 
         """
-        url = urljoin(BASE_HTTP_URL, self._API_ENDPOINT + str(contact_id) + alias)
+        url = urljoin(BASE_HTTP_URL, self._API_ENDPOINT + f"{str(contact_id)}/alias")
         _post(url, headers=self._headers, json={"alias": alias})
 
     def delete(self, contact_id: int) -> None:
diff --git a/tests/briar_wrapper/models/test_contacts.py b/tests/briar_wrapper/models/test_contacts.py
index 0794513..f7531a2 100644
--- a/tests/briar_wrapper/models/test_contacts.py
+++ b/tests/briar_wrapper/models/test_contacts.py
@@ -55,10 +55,10 @@ def test_set_alias(api, request_headers, requests_mock):
     contacts = Contacts(api)
     contact_id = 137
     requests_mock.register_uri("POST",
-                               BASE_HTTP_URL + f"/{contact_id}/alias",
+                               BASE_HTTP_URL + f"{contact_id}/alias",
                                request_headers=request_headers,
-                               additional_matcher=match_request_add_pending)
-    contacts.add_pending(contact_id, TEST_ALIAS)
+                               additional_matcher=match_request_set_alias)
+    contacts.set_alias(contact_id, TEST_ALIAS)
 
 
 def match_request_set_alias(request):
-- 
GitLab