diff --git a/src/postorius/tests/test_address_activation.py b/src/postorius/tests/test_address_activation.py index adcd29c..71877ca 100644 --- a/src/postorius/tests/test_address_activation.py +++ b/src/postorius/tests/test_address_activation.py @@ -9,7 +9,7 @@ from django.core import mail from django.test.client import Client, RequestFactory from django.test.utils import override_settings -from django.utils import unittest +from django.test import TestCase from mock import patch, call from postorius.forms import AddressActivationForm @@ -18,7 +18,7 @@ from postorius.views.user import AddressActivationView, address_activation_link -class TestAddressActivationForm(unittest.TestCase): +class TestAddressActivationForm(TestCase): """ Test the activation form. """ @@ -48,7 +48,7 @@ self.assertFalse(form.is_valid()) -class TestAddressActivationView(unittest.TestCase): +class TestAddressActivationView(TestCase): """ Tests to make sure the view is properly connected, renders the form correctly and starts the actual address activation process if a valid @@ -104,7 +104,7 @@ in [t.name for t in response.templates]) -class TestAddressConfirmationProfile(unittest.TestCase): +class TestAddressConfirmationProfile(TestCase): """ Test the confirmation of an email address activation (validating token, expiration, Mailman API calls etc.). @@ -186,7 +186,7 @@ self.assertIn("another-virtualhost", mail.outbox[0].body) -class TestAddressActivationLinkSuccess(unittest.TestCase): +class TestAddressActivationLinkSuccess(TestCase): """ This tests the activation link view if the key is valid and the profile is not expired. diff --git a/src/postorius/tests/test_auth_decorators.py b/src/postorius/tests/test_auth_decorators.py index 593e66b..6c8e9ce 100644 --- a/src/postorius/tests/test_auth_decorators.py +++ b/src/postorius/tests/test_auth_decorators.py @@ -18,7 +18,7 @@ from django.contrib.auth.models import AnonymousUser, User from django.core.exceptions import PermissionDenied from django.test.client import RequestFactory -from django.utils import unittest +from django.test import TestCase from mock import patch from postorius.auth.decorators import (list_owner_required, @@ -39,7 +39,7 @@ return True -class ListOwnerRequiredTest(unittest.TestCase): +class ListOwnerRequiredTest(TestCase): """Tests the list_owner_required auth decorator.""" def setUp(self): @@ -105,7 +105,7 @@ self.assertEqual(return_value, True) -class ListModeratorRequiredTest(unittest.TestCase): +class ListModeratorRequiredTest(TestCase): """Tests the list_owner_required auth decorator.""" def setUp(self): diff --git a/src/postorius/tests/test_forms.py b/src/postorius/tests/test_forms.py index 58717bd..f5cb781 100644 --- a/src/postorius/tests/test_forms.py +++ b/src/postorius/tests/test_forms.py @@ -14,13 +14,13 @@ # # You should have received a copy of the GNU General Public License along with # Postorius. If not, see . -from django.utils import unittest +from django.test import TestCase from postorius.forms import (ListNew, UserPreferences, DomainNew, ListSubscribe, ChangeSubscriptionForm) -class UserPreferencesTest(unittest.TestCase): +class UserPreferencesTest(TestCase): def test_form_fields_valid(self): form = UserPreferences({ @@ -31,7 +31,7 @@ }) self.assertTrue(form.is_valid()) -class DomainNewTest(unittest.TestCase): +class DomainNewTest(TestCase): def test_form_fields_webhost(self): form = DomainNew({ @@ -52,7 +52,7 @@ self.assertFalse(form.is_valid()) -class ListSubscribeTest(unittest.TestCase): +class ListSubscribeTest(TestCase): def test_subscribe_works(self): user_emails = ['someone@example.com'] form = ListSubscribe(user_emails, { @@ -78,7 +78,7 @@ }) self.assertFalse(form.is_valid()) -class ChangeSubscriptionTest(unittest.TestCase): +class ChangeSubscriptionTest(TestCase): def test_subscription_changes_only_to_user_addresses(self): user_emails = ['one@example.com', 'two@example.com'] form = ChangeSubscriptionForm(user_emails, @@ -92,7 +92,7 @@ self.assertTrue(form.is_valid()) -class ListNewTest(unittest.TestCase): +class ListNewTest(TestCase): def test_form_fields_list(self): form = ListNew({