Esempio n. 1
0
    def test_cohort_absolute_url(self):
        '''This tests the absolute_url generation of a :class:`~mousedb.data.models.Cohort`.'''

        test_cohort = Cohort(name = 'Test Cohort')
        test_cohort.save() 
        test_cohort.animals.add = Animal.objects.all()
        self.assertEqual(test_cohort.get_absolute_url(), "/cohort/test-cohort")        
Esempio n. 2
0
    def test_cohort_unicode(self):
        '''This tests the unicode representation of a :class:`~mousedb.data.models.Cohort`.'''

        test_cohort = Cohort(name = 'Test Cohort')
        test_cohort.save() 
        test_cohort.animals.add = Animal.objects.all()
        self.assertEqual(test_cohort.__unicode__(), "Test Cohort") 
Esempio n. 3
0
    def test_create_cohort_minimum(self):
        '''This test creates a :class:`~mousedb.data.models.Cohort` with the required information only.'''

        test_cohort = Cohort(name = 'Test Cohort')
        test_cohort.save() 
        test_cohort.animals.add = Animal.objects.all()
        self.assertEqual(test_cohort.pk, 1) #presumes no models loaded in fixture data
Esempio n. 4
0
    def test_create_cohort_all(self):
        '''This test creates a :class:`~mousedb.data.models.Cohort` with all information entered.'''

        test_cohort = Cohort(name = 'Test Cohort',
                             start_date = '2012-01-01',
                             end_date = '2012-08-01',
                             notes = "Some notes about this cohort")
        test_cohort.save() 
        test_cohort.animals.add = Animal.objects.all()
        test_cohort.treatment_groups.all = Treatment.objects.get(pk=1)
        test_cohort.studies.all = Study.objects.get(pk=1)
        self.assertEqual(test_cohort.pk, 1) #presumes no models loaded in fixture data