Carl Meyer avatar Carl Meyer committed 79d1c42 Draft

Add tests for StatusField no_check_for_status.

Comments (0)

Files changed (1)

model_utils/tests/tests.py

 from django.test import TestCase
 
 from model_utils import Choices, ModelTracker
-from model_utils.fields import get_excerpt, MonitorField
+from model_utils.fields import get_excerpt, MonitorField, StatusField
 from model_utils.managers import QueryManager
 from model_utils.models import StatusModel, TimeFramedModel
 from model_utils.tests.models import (
         instance = StatusFieldDefaultNotFilled()
         self.assertEquals(instance.status, instance.STATUS.no)
 
+    def test_no_check_for_status(self):
+        field = StatusField(no_check_for_status=True)
+        # this model has no STATUS attribute, so checking for it would error
+        field.prepare_class(Article)
+
 
 class ChoicesTests(TestCase):
     def setUp(self):
                               NoRendered._meta.get_field,
                               '_body_excerpt')
 
+        def test_status_field_no_check_for_status(self):
+            sf = StatusFieldDefaultFilled._meta.get_field('status')
+            args, kwargs = introspector(sf)
+            self.assertEqual(kwargs['no_check_for_status'], 'True')
+
 
 
 class PassThroughManagerTests(TestCase):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.