Пример #1
0
    def test_create_breeding_minimal(self):
        """This is a test for creating a new breeding object, with only the minimum being entered."""
        example_strain = Strain(Strain="Example Strain")
        example_strain.save()
        new_breeding = Breeding(Strain = example_strain)
        new_breeding.save()
	test_breeding = Breeding.objects.get(Strain=example_strain)
        self.assertEquals(test_breeding, new_breeding)
        self.assertEquals(test_breeding.__unicode__(), "Example Strain Breeding Cage: None starting on None")
        print "create_breeding_minimal... passed"
Пример #2
0
    def test_autoset_active_state(self):
        """This is a test for creating a new breeding object, with only the minimum being entered.  That object is then tested for the active state being automatically set when a End date is specified."""
        example_strain = Strain(Strain="Example Strain")
        example_strain.save()
        new_breeding = Breeding(Strain = example_strain)
        new_breeding.save()
        test_breeding = Breeding.objects.get(Strain=example_strain)
        self.assertEquals(test_breeding.Active, True)
        test_breeding.End = datetime.date.today()
        test_breeding.save()
        self.assertEquals(test_breeding.Active, False)
        print "autoset_breeding_active_state... passed"
		
	def test_male_breeding_location_type(self):
	    """This is a test that the breeding_location_type attribute is being set correctly.
		
        Normal function is that if the breeding cage of a Breeding object and the cage of an Animal object are the same then the breeding male is set to "resident breeder", if not then it is a "non-resident breeder"""
        example_strain = Strain(Strain="Example Strain")
        example_strain.save()
        animal = Animal(Strain = example_strain, Genotype="-/-", Background="Mixed", Cage=1234, Gender='M')
        animal.save()		
        test_breeding = Breeding(Strain = example_strain, Male=animal, Cage=1234)
        test_breeding.save()
        self.assertEquals(test_breeding.male_breeding_location_type, "resident breeder")
        test_breeding_nr = Breeding(Strain = example_strain, Male=animal, Cage=5678)
        self.assertEquals(test_breeding.male_breeding_location_type, "non-resident breeder")
        print "male_breeding_location_type... passed"
Пример #3
0
 def test_create_breeding_minimal(self):
     """This is a test for creating a new breeding object, with only the minimum being entered."""
     test_breeding = Breeding(Strain = Strain.objects.get(pk=1))
     test_breeding.save()
     self.assertEquals(test_breeding.pk,  4)