Revert original update user method and add new attribute update (with strict checking)

This commit is contained in:
Imdad Ahad
2016-11-09 15:06:02 +00:00
parent c28aea2de1
commit f3ca33dad3
2 changed files with 30 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
import pytest
from app.notify_client.user_api_client import UserApiClient
@@ -13,3 +15,10 @@ def test_client_uses_correct_find_by_email(mocker, api_user_active):
client.get_user_by_email(api_user_active.email_address)
mock_get.assert_called_once_with(expected_url, params=expected_params)
def test_client_only_updates_allowed_attributes(mocker):
mocker.patch('app.notify_client.current_user', id='1')
with pytest.raises(TypeError) as error:
UserApiClient().update_user_attribute('user_id', id='1')
assert str(error.value) == 'Not allowed to update user attributes: id'