Coverage for django_napse/utils/model_test_case.py: 82%
34 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
1from django_napse.utils.custom_test_case import CustomTestCase
4class ModelTestCase(CustomTestCase):
5 model = None
6 exchange = None
8 def simple_create(self):
9 error_msg = "You must define a simple_create method."
10 raise NotImplementedError(error_msg)
12 def test_setup(self):
13 skip, reason = self.skip_condition()
14 if skip:
15 self.skipTest(reason)
16 if self.model is None:
17 error_msg = f"ModelTestCase subclass {self.__class__.__name__} must define a model attribute."
18 raise NotImplementedError(error_msg)
20 def test_simple_creation(self):
21 skip, reason = self.skip_condition()
22 if skip:
23 self.skipTest(reason)
24 instance = self.simple_create()
25 if instance is None:
26 error_msg = "simple_create method must return the created instance."
27 raise ValueError(error_msg)
29 def test_info(self):
30 skip, reason = self.skip_condition()
31 if skip:
32 self.skipTest(reason)
33 instance = self.simple_create()
34 instance.info(verbose=False)
36 def test_str(self):
37 skip, reason = self.skip_condition()
38 if skip:
39 self.skipTest(reason)
40 instance = self.simple_create()
41 instance.__str__()