Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Python Briar Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
Python Briar Wrapper
Commits
dedbbd63
Commit
dedbbd63
authored
4 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
Finalize support
parent
a4e9fc27
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!16
Support changing contact alias
Pipeline
#4985
passed
4 years ago
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
briar_wrapper/models/contacts.py
+2
-1
2 additions, 1 deletion
briar_wrapper/models/contacts.py
tests/briar_wrapper/models/test_contacts.py
+3
-3
3 additions, 3 deletions
tests/briar_wrapper/models/test_contacts.py
with
5 additions
and
4 deletions
briar_wrapper/models/contacts.py
+
2
−
1
View file @
dedbbd63
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
tests/briar_wrapper/models/test_contacts.py
+
3
−
3
View file @
dedbbd63
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment