diff --git a/forms/test_models.py b/forms/test_models.py new file mode 100644 index 00000000..743171c9 --- /dev/null +++ b/forms/test_models.py @@ -0,0 +1,18 @@ +from django.test import TestCase +from forms import models + +class FormModelsTestCase(TestCase): + def setUp(self): + self.schemaType1 = models.Type.objects.create(name="Test Type",description="Description of a test type") + models.Schema.objects.create(start_at='2014-03-01',comment='test1', schema_type=self.schemaType1) + models.Schema.objects.create(start_at='2016-03-01',comment='test2', schema_type=self.schemaType1) + + self.schemaType2 = models.Type.objects.create(name="Test Type 2",description="Description of the second test type") + models.Schema.objects.create(start_at='2014-03-01',comment='test3', schema_type=self.schemaType2) + models.Schema.objects.create(start_at='2016-03-01',comment='test4', schema_type=self.schemaType2) + + def test_find_correct(self): + r = models.Schema.objects.find_schema(self.schemaType1, '2015-03-01') + self.assertEqual(r.comment, 'test1') + r = models.Schema.objects.find_schema(self.schemaType1, '2016-03-01') + self.assertEqual(r.comment, 'test2') \ No newline at end of file diff --git a/forms/tests.py b/forms/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/forms/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here.