From c78ff60231c877643264570929cb785483dd6e8f Mon Sep 17 00:00:00 2001 From: reverend Date: Sun, 13 Sep 2020 13:31:41 +0200 Subject: [PATCH] Refactoring ModelTestCase --- lostplaces/lostplaces_app/tests/models/__init__.py | 4 ++-- .../lostplaces_app/tests/models/test_abstract_models.py | 6 +++--- .../lostplaces_app/tests/models/test_voucher_model.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lostplaces/lostplaces_app/tests/models/__init__.py b/lostplaces/lostplaces_app/tests/models/__init__.py index ffb9832..c24309e 100644 --- a/lostplaces/lostplaces_app/tests/models/__init__.py +++ b/lostplaces/lostplaces_app/tests/models/__init__.py @@ -5,7 +5,7 @@ from django.test import TestCase # Creating a test user -class ModelTestCase: +class ModelTestCaseMixin: ''' Base class for ModelTests ''' @@ -151,7 +151,7 @@ class ModelTestCase: ) -class SubmittableTestCase(ModelTestCase): +class SubmittableTestCase(ModelTestCaseMixin): related_name = None nullable = False diff --git a/lostplaces/lostplaces_app/tests/models/test_abstract_models.py b/lostplaces/lostplaces_app/tests/models/test_abstract_models.py index fa023d7..e4a6d70 100644 --- a/lostplaces/lostplaces_app/tests/models/test_abstract_models.py +++ b/lostplaces/lostplaces_app/tests/models/test_abstract_models.py @@ -5,12 +5,12 @@ from django.db import models from django.contrib.auth.models import User from lostplaces_app.models import Place, Taggable, MapablePoint -from lostplaces_app.tests.models import ModelTestCase +from lostplaces_app.tests.models import ModelTestCaseMixin from taggit.managers import TaggableManager -class TaggableTestCase(ModelTestCase, TestCase): +class TaggableTestCase(ModelTestCaseMixin, TestCase): model = Taggable @@ -18,7 +18,7 @@ class TaggableTestCase(ModelTestCase, TestCase): self.assertField('tags', TaggableManager) -class MapablePointTestCase(ModelTestCase, TestCase): +class MapablePointTestCase(ModelTestCaseMixin, TestCase): model = MapablePoint diff --git a/lostplaces/lostplaces_app/tests/models/test_voucher_model.py b/lostplaces/lostplaces_app/tests/models/test_voucher_model.py index 74a9fe0..5c22f02 100644 --- a/lostplaces/lostplaces_app/tests/models/test_voucher_model.py +++ b/lostplaces/lostplaces_app/tests/models/test_voucher_model.py @@ -5,10 +5,10 @@ from django.db import models from django.utils import timezone from lostplaces_app.models import Voucher -from lostplaces_app.tests.models import ModelTestCase +from lostplaces_app.tests.models import ModelTestCaseMixin -class VoucheTestCase(ModelTestCase, TestCase): +class VoucheTestCase(ModelTestCaseMixin, TestCase): model = Voucher @classmethod