| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from django.core.exceptions import ImproperlyConfigured |
| 4 |
from django.db import models |
| 5 |
from django.test import TestCase |
| 6 |
|
| 7 |
from model_utils.managers import QueryManager |
| 8 |
from model_utils.models import StatusModel |
| 9 |
from tests.models import StatusManagerAdded |
| 10 |
|
| 11 |
|
| 12 |
class StatusManagerAddedTests(TestCase): |
| 13 |
def test_manager_available(self) -> None: |
| 14 |
self.assertTrue(isinstance(StatusManagerAdded.active, QueryManager)) |
| 15 |
|
| 16 |
def test_conflict_error(self) -> None: |
| 17 |
with self.assertRaises(ImproperlyConfigured): |
| 18 |
class ErrorModel(StatusModel): |
| 19 |
STATUS = ( |
| 20 |
('active', 'Is Active'), |
| 21 |
('deleted', 'Is Deleted'), |
| 22 |
) |
| 23 |
active = models.BooleanField() |