def test_delete_single_user(self, mock_ctrl, mock_resp, mock_perm, mock_rev): """ Test user deletion. """ mock_perm().find_one.return_value = 'some' request = mock.MagicMock() user = UserResourceView() response = user.delete(request, 'test-user') mock_ctrl.delete_user.assert_called_once_with('test-user') mock_resp.assert_called_once_with() mock_perm().remove.assert_called_once_with({'resource': mock_rev.return_value}) self.assertTrue(response is mock_resp.return_value)
def test_delete_single_user(self, mock_factory, mock_resp, mock_perm): """ Test user deletion. """ mock_factory.user_manager.return_value.delete_user.return_value = None mock_perm.return_value.find_one.return_value = 'some' request = mock.MagicMock() user = UserResourceView() response = user.delete(request, 'test-user') mock_factory.user_manager.return_value.delete_user.assert_called_once_with('test-user') mock_resp.assert_called_once_with(None) self.assertTrue(response is mock_resp.return_value)
def test_delete_single_user(self, mock_factory, mock_resp, mock_perm): """ Test user deletion. """ mock_factory.user_manager.return_value.delete_user.return_value = None mock_perm.return_value.find_one.return_value = 'some' request = mock.MagicMock() user = UserResourceView() response = user.delete(request, 'test-user') mock_factory.user_manager.return_value.delete_user.assert_called_once_with( 'test-user') mock_resp.assert_called_once_with(None) self.assertTrue(response is mock_resp.return_value)