Skip to content

Commit 2a3d0e6

Browse files
Merge branch 'main' into add-delete_user-and-delete_user_authenticator-method
2 parents da0bc52 + 4881f01 commit 2a3d0e6

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

authsignal/client.py

+17
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,23 @@ def delete_user_authenticator(self, user_id: str, user_authenticator_id: str) ->
189189
return humps.decamelize(response.json())
190190
except requests.exceptions.RequestException as e:
191191
raise ApiException(str(e), path) from e
192+
193+
def update_user(self, user_id, data):
194+
user_id = urllib.parse.quote(user_id)
195+
196+
path = self._get_user_url(user_id)
197+
198+
headers = self._default_headers()
199+
200+
response = requests.post(path,
201+
json=data,
202+
headers=headers,
203+
auth=requests.auth.HTTPBasicAuth(self.api_key, '')
204+
)
205+
206+
response.raise_for_status()
207+
208+
return humps.decamelize(response.json())
192209

193210
def enroll_verified_authenticator(self, user_id, authenticator_payload, path=None):
194211
"""Enrols an authenticator like a phone number for SMS on behalf of the user

authsignal/client_tests.py

+12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ def test_delete_user(self):
9494
response = self.authsignal_client.delete_user(user_id="1234")
9595

9696
self.assertEqual(response["success"], True)
97+
98+
def test_update_user(self):
99+
user_id = "1234"
100+
data = {"email": "[email protected]"}
101+
expected_response = {"email": "[email protected]"}
102+
103+
responses.add(responses.POST, f"{base_url}/users/{user_id}",
104+
json=expected_response, status=200)
105+
106+
response = self.authsignal_client.update_user(user_id=user_id, data=data)
107+
108+
self.assertEqual(response["email"], "[email protected]")
97109

98110
class ValidateChallenge(unittest.TestCase):
99111
def setUp(self):

authsignal/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.0.5'
1+
VERSION = '2.0.5'

0 commit comments

Comments
 (0)