From 0fea8a4d92638e39950225e2fb41c246d22441e1 Mon Sep 17 00:00:00 2001 From: Tadas Dailyda Date: Tue, 25 Jul 2017 14:02:15 +0300 Subject: [PATCH] tests for abstract/swappable model initialization --- polymorphic/tests/__init__.py | 17 +++++++++++++++++ runtests.py | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/polymorphic/tests/__init__.py b/polymorphic/tests/__init__.py index b16a917..32e1838 100644 --- a/polymorphic/tests/__init__.py +++ b/polymorphic/tests/__init__.py @@ -400,6 +400,23 @@ class DateModel(PolymorphicModel): date = models.DateTimeField() +# Define abstract and swappable (being swapped for SwappedModel) models +# To test manager validation (should be skipped for such models) +class AbstractModel(PolymorphicModel): + class Meta: + abstract = True + + +class SwappableModel(AbstractModel): + class Meta: + swappable = 'POLYMORPHIC_TEST_SWAPPABLE' + + +class SwappedModel(AbstractModel): + pass + + + # Import tests from .test_admin import * from .test_orm import * diff --git a/runtests.py b/runtests.py index 0e76c03..f0a1609 100755 --- a/runtests.py +++ b/runtests.py @@ -57,7 +57,8 @@ if not settings.configured: ), }, }, - ] + ], + POLYMORPHIC_TEST_SWAPPABLE='polymorphic.swappedmodel', )