mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Added initial model tests
This commit is contained in:
18
forms/test_models.py
Normal file
18
forms/test_models.py
Normal file
@@ -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')
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
Reference in New Issue
Block a user