Beispiel #1
0
    def test_manage_storage_different_user(self, mock_messages, mock_redirect):
        mock_request = mock.MagicMock()
        mock_request.user.username = '******'

        manage_storage(mock_request, 'ThisIsMe')

        mock_messages.assert_called_once_with(mock_request, "You are not allowed to change other users' settings.")
        mock_redirect.assert_called_once_with('user:profile', username=mock_request.user.username)
Beispiel #2
0
    def test_manage_storage_successful(self, mock_render, mock_harvester, mock_user, mock_convert_storage, _, __):
        mock_request = mock.MagicMock()
        mock_request.user.username = '******'
        app = TethysApp(name="app_name")
        mock_harvester().apps = [app]
        mock_user.objects.get.return_value = mock.MagicMock()
        mock_convert_storage.return_value = '0 bytes'

        expected_context = {'apps': mock_harvester().apps,
                            'context_user': mock_request.user,
                            'current_use': '0 bytes',
                            'quota': None,
                            }

        manage_storage(mock_request, 'ThisIsMe')

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