示例#1
0
 def test_create_strain_all(self):
     """This is a test for creating a new strain object, with only all fields being entered.  Returns pk 2 since one field was already entered."""
     test_strain = Strain(
         Strain = "Test Strain", 
         Strain_slug = "test-strain",
         Source = "The test strain came from some place",
         Comments = "Here are some comments about the Test Strain")
     test_strain.save()
     self.assertEquals(test_strain.id, 2)
示例#2
0
文件: tests.py 项目: twonds/mousedb
 def test_create_animal_minimal(self):
     """This is a test for creating a new animal object, with only the minimum fields being entered"""
     example_strain = Strain(Strain="Example Strain")
     example_strain.save()
     animal = Animal(Strain = example_strain, Genotype="-/-", Background="Mixed")
     animal.save()
     animal_id = animal.id
     self.assertEquals(animal.__unicode__(), "Example Strain (%s)" % animal_id)
     print "create_animal_minimal... passed"
示例#3
0
文件: tests.py 项目: twonds/mousedb
    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"
示例#4
0
文件: tests.py 项目: twonds/mousedb
 def test_unicode(self):
     """This is a test for creating a new animal object, with only the minimum fields being entered.  It then tests that the correct unicode representation is being generated."""
     example_strain = Strain(Strain="Example Strain")
     example_strain.save()
     animal = Animal(Strain = example_strain, Genotype="-/-", Background="Mixed")
     animal.save()
     animal_id = animal.id
     self.assertEquals(animal.__unicode__(), "Example Strain (%s)" % animal_id)
     animal.MouseID = 1234
     animal.save()
     self.assertEquals(animal.__unicode__(), "Example Strain-EarTag #1234")
     print "animal_unicode... passed"
示例#5
0
文件: tests.py 项目: twonds/mousedb
    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"
示例#6
0
 def test_strain_absolute_url(self):
     """This is a test for creating a new strain object, then testing absolute url."""
     test_strain = Strain(Strain = "Test Strain", Strain_slug = "test-strain")
     test_strain.save()
     self.assertEquals(test_strain.get_absolute_url(), "/strain/test-strain")        
示例#7
0
 def test_strain_unicode(self):
     """This is a test for creating a new strain object, then testing the unicode representation of the strain."""
     test_strain = Strain(Strain = "Test Strain", Strain_slug = "test-strain")
     test_strain.save()
     self.assertEquals(test_strain.__unicode__(), "Test Strain")
示例#8
0
 def test_create_strain_minimal(self):
     """This is a test for creating a new strain object, with only the minimum fields being entered.    Returns pk 2 since one field was already entered."""
     test_strain = Strain(Strain = "Test Strain", Strain_slug = "test-strain")
     test_strain.save()
     self.assertEquals(test_strain.id, 2)