From b9eca67b0db5efa1af334dd31d820c5b43bb8013 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Thu, 9 Nov 2017 14:55:08 +0000 Subject: [PATCH] Revert "use new activate endpoint" --- app/notify_client/user_api_client.py | 5 +++-- tests/app/notify_client/test_user_client.py | 19 ------------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/app/notify_client/user_api_client.py b/app/notify_client/user_api_client.py index 0b1970d06..0df41e045 100644 --- a/app/notify_client/user_api_client.py +++ b/app/notify_client/user_api_client.py @@ -148,8 +148,9 @@ class UserApiClient(NotifyAdminAPIClient): def activate_user(self, user): if user.state == 'pending': - url = "/user/{}/activate".format(user.id) - user_data = self.post(url) + user.state = 'active' + url = "/user/{}".format(user.id) + user_data = self.post(url, data={'state': 'active'}) return User(user_data['data'], max_failed_login_count=self.max_failed_login_count) else: return user diff --git a/tests/app/notify_client/test_user_client.py b/tests/app/notify_client/test_user_client.py index 5f2f728ec..9c056c42b 100644 --- a/tests/app/notify_client/test_user_client.py +++ b/tests/app/notify_client/test_user_client.py @@ -33,22 +33,3 @@ def test_client_updates_password_separately(mocker, api_user_active): client.update_password(api_user_active.id, expected_params['_password']) mock_update_password.assert_called_once_with(expected_url, data=expected_params) - - -def test_client_activates_if_pending(mocker, api_user_pending): - mock_post = mocker.patch('app.notify_client.user_api_client.UserApiClient.post') - client = UserApiClient() - client.max_failed_login_count = 1 # doesn't matter for this test - - client.activate_user(api_user_pending) - - mock_post.assert_called_once_with('/user/{}/activate'.format(api_user_pending.id)) - - -def test_client_doesnt_activate_if_already_active(mocker, api_user_active): - mock_post = mocker.patch('app.notify_client.user_api_client.UserApiClient.post') - client = UserApiClient() - - client.activate_user(api_user_active) - - assert not mock_post.called