Beispiel #1
0
    def test_treatment_absolute_url(self):
        '''This tests the absolute_url generation of a :class:`~mousedb.data.models.Treatment`.'''

        test_treatment = Treatment(treatment = 'Test Treatment', 
            diet = Diet.objects.get(pk=1),
            environment = Environment.objects.get(pk=1))
        test_treatment.save()
        test_treatment.animals.add(Animal.objects.get(pk=1))
        test_treatment.researchers.add(Researcher.objects.get(pk=1))
        self.assertEqual(test_treatment.get_absolute_url(), "/treatment/1")
Beispiel #2
0
    def test_treatment_unicode(self):
        '''This tests the unicode representation of a :class:`~mousedb.data.models.Treatment`.'''

        test_treatment = Treatment(treatment = 'Test Treatment', 
            diet = Diet.objects.get(pk=1),
            environment = Environment.objects.get(pk=1))
        test_treatment.save()
        test_treatment.animals.add(Animal.objects.get(pk=1))
        test_treatment.researchers.add(Researcher.objects.get(pk=1))
        self.assertEqual(test_treatment.__unicode__(), "Test Treatment")  
Beispiel #3
0
    def test_create_treatment_minimum(self):
        '''This test creates a :class:`~mousedb.data.models.Treatment` with the required information only.'''

        test_treatment = Treatment(treatment = 'Test Treatment', 
            diet = Diet.objects.get(pk=1),
            environment = Environment.objects.get(pk=1))
        test_treatment.save()
        test_treatment.animals.add(Animal.objects.get(pk=1))
        test_treatment.researchers.add(Researcher.objects.get(pk=1))
        self.assertEqual(test_treatment.pk, 1) #presumes no models loaded in fixture data
Beispiel #4
0
    def test_create_treatment_all(self):
        '''This test creates a :class:`~mousedb.data.models.Treatment` with all information entered.'''

        test_treatment = Treatment(treatment = 'Test Treatment', 
            diet = Diet.objects.get(pk=1),
            environment = Environment.objects.get(pk=1),
            study = Study.objects.get(pk=1),
            transplantation = Transplantation.objects.get(pk=1),
            notes = "Some notes about this test treatment."
            )
        test_treatment.save()
        test_treatment.animals.add(Animal.objects.get(pk=1))
        test_treatment.researchers.add(Researcher.objects.get(pk=1))
        test_treatment.pharmaceutical.add(Pharmaceutical.objects.get(pk=1))  
        test_treatment.implantation.add(Implantation.objects.get(pk=1))                
        self.assertEqual(test_treatment.pk, 1) #presumes no models loaded in fixture data