Exemple #1
0
    def test_social_disconnect_invalid_user(self, mock_redirect, mock_message_warn):
        username = '******'

        mock_request_user = mock.MagicMock()
        mock_request_user.username = '******'

        mock_request = mock.MagicMock()
        mock_request.user = mock_request_user

        mock_provider = mock.MagicMock()

        mock_association_id = mock.MagicMock()

        social_disconnect(mock_request, username, mock_provider, mock_association_id)

        mock_message_warn.assert_called_once_with(mock_request, "You are not allowed to change other users' settings.")

        mock_redirect.assert_called_once_with('user:profile', username='******')
Exemple #2
0
    def test_social_disconnect_valid_user(self, mock_render):
        username = '******'

        mock_request_user = mock.MagicMock()
        mock_request_user.username = '******'

        mock_request = mock.MagicMock()
        mock_request.user = mock_request_user

        mock_provider = mock.MagicMock()

        mock_association_id = mock.MagicMock()

        expected_context = {'provider': mock_provider,
                            'association_id': mock_association_id}

        social_disconnect(mock_request, username, mock_provider, mock_association_id)

        mock_render.assert_called_once_with(mock_request, 'tethys_portal/user/disconnect.html', expected_context)