def test_retrive_user_info_fail_when_server_handle_404(self, m): user = self.make_user(username=self.valid_data['username']) user_id = str(user.uuid) m.register_uri( 'POST', f'http://127.0.0.1:8000/random_404/authentication/users/{user_id}', json={}, status_code=404) found, remote_response = UserInteractor.retrive_user_info(user=user) self.assertFalse(found) self.assertEquals(len(remote_response), 0)
def test_retrive_user_info(self, m): user = self.make_user(username=self.valid_data['username']) user_id = str(user.uuid) m.register_uri( 'GET', f'http://127.0.0.1:8000/api/authentication/users/{user_id}', json={ 'username': user.username, 'email': user.email, 'uuid': user_id }, status_code=200) found, remote_response = UserInteractor.retrive_user_info(user=user) self.assertEquals(remote_response['username'], self.valid_data['username'])