django-model-utils/tests/test_managers/test_status_manager.py
Adam Dobrawy ffa1a85dc7 Modernize Python syntax, add Python 3.8 (#398)
* Modernize Python syntax, add Python 3.8

* Update Python version & dist in TravisCI

* Add postgresql as addon

* Switch to psycopg2-binary

* Drop django.utils.six
2019-11-14 22:50:04 +06:00

21 lines
727 B
Python

from django.db import models
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from model_utils.managers import QueryManager
from model_utils.models import StatusModel
from tests.models import StatusManagerAdded
class StatusManagerAddedTests(TestCase):
def test_manager_available(self):
self.assertTrue(isinstance(StatusManagerAdded.active, QueryManager))
def test_conflict_error(self):
with self.assertRaises(ImproperlyConfigured):
class ErrorModel(StatusModel):
STATUS = (
('active', 'Is Active'),
('deleted', 'Is Deleted'),
)
active = models.BooleanField()