Ejemplo n.º 1
0
 def test_end_hour_string(self):
     self.new_expedition = Expedition(field_notes="some field notes here")
     self.new_expedition.save()
     end_hour_string = self.new_expedition.end_hour_string()
     self.assertIsNotNone(end_hour_string)
     self.assertEquals(
         end_hour_string,
         "%02d" % self.new_expedition.end_date_of_expedition.hour)
Ejemplo n.º 2
0
def new_expeditions():
    """ hardwiring for now """
    for eid in test_expedition_ids:
        the_new_expedition = Expedition()
        the_new_expedition.id = int(eid)
        the_new_expedition.start_date_of_expedition = datetime.now()
        the_new_expedition.created_on = datetime.now()
        the_new_expedition.save()
Ejemplo n.º 3
0
 def setUp(self):
     ''' trying to create sighting leaving out attibtutes whic are
     key or objects - location = objects = species = date = observers
     =    observation_type =     how_many_observed =      notes ='''
     self.sighting = Sighting()
     self.sighting.save()
     self.expedition = Expedition()
     self.expedition.save()
     # objects = models.GeoManager()
     self.trap_location = TrapLocation(
         expedition=self.expedition,
         notes_about_location="Notes about the location",
         team_letter='C',
         whether_a_trap_was_set_here=True,
         bait_still_there=False,
         notes_about_outcome='This is a good place for a trap.',
         student_names='Student 1, Student 2, Student 3')
     self.trap_location.save()
     self.species = Species(
         latin_name="official_mouse_name",
         common_name="blackrock_mouse",
         about_this_species="too smart for traps",
     )
     self.species.save()
     # left off sex of animal, age of animal, scale used - foreign keys?
     #  other details which were booleans with default left off
     self.animal_1 = Animal(species=self.species,
                            description="this is a special mouse",
                            tag_number="6789",
                            health="excellent",
                            weight_in_grams=35)
     self.animal_1.save()
     # left off sex of animal, age of animal, scale used - foreign
     # keys? other details which were booleans with default left off
     self.animal_2 = Animal(species=self.species,
                            description="this is a naughty mouse",
                            tag_number="8355",
                            health="excellent",
                            weight_in_grams=45)
     self.animal_2.save()
     # left off sex of animal, age of animal, scale used - foreign keys?
     # other details which were booleans with default left off
     self.animal_3 = Animal(species=self.species,
                            description="this is a super mouse",
                            tag_number="8888",
                            health="excellent",
                            weight_in_grams=15)
     self.animal_3.save()
     self.another_expedition = Expedition(
         start_date_of_expedition=datetime.now(),
         end_date_of_expedition=datetime.now())
     self.another_expedition.save()
     self.habitat = Habitat(label="habitat label",
                            blurb="this is a habitat",
                            image_path_for_legend="/path/here",
                            color_for_map="111")
     self.habitat.save()
     self.trap_1 = TrapLocation(expedition=self.another_expedition,
                                team_letter="A",
                                team_number=1,
                                whether_a_trap_was_set_here=True,
                                bait_still_there=False,
                                habitat=self.habitat,
                                animal=self.animal_1)
     self.trap_1.save()
     self.trap_2 = TrapLocation(expedition=self.another_expedition,
                                team_letter="B",
                                team_number=2,
                                whether_a_trap_was_set_here=True,
                                bait_still_there=False,
                                habitat=self.habitat,
                                animal=self.animal_2)
     self.trap_2.save()
     self.trap_3 = TrapLocation(expedition=self.another_expedition,
                                team_letter="C",
                                team_number=3,
                                whether_a_trap_was_set_here=True,
                                bait_still_there=False,
                                habitat=self.habitat,
                                animal=self.animal_3)
     self.trap_3.save()
     self.trap_4 = TrapLocation(expedition=self.another_expedition,
                                team_letter="D",
                                team_number=4,
                                whether_a_trap_was_set_here=True,
                                bait_still_there=False,
                                habitat=self.habitat)
     self.trap_4.save()
     self.another_expedition.save()
     self.timed_expedition = Expedition(
         end_date_of_expedition=datetime.now())
     self.timed_expedition.save()
     self.time_trap = TrapLocation(expedition=self.timed_expedition,
                                   team_letter="team name here",
                                   team_number=6,
                                   habitat=self.habitat,
                                   whether_a_trap_was_set_here=True,
                                   bait_still_there=False,
                                   animal=self.animal_1)
     self.time_trap.save()
     self.new_sighting = Sighting(species=self.species, date=datetime.now())
     self.new_sighting.save()
     self.grid_point_nw = GridPoint()
     self.grid_point_nw.save()
     self.grid_point_ne = GridPoint()
     self.grid_point_ne.save()
     self.grid_point_sw = GridPoint()
     self.grid_point_sw.save()
     self.grid_point_se = GridPoint()
     self.grid_point_se.save()
     self.grid_point_center = GridPoint()
     self.grid_point_center.save()
     self.grid_square = GridSquare(NW_corner=self.grid_point_nw,
                                   NE_corner=self.grid_point_ne,
                                   SW_corner=self.grid_point_sw,
                                   SE_corner=self.grid_point_se,
                                   center=self.grid_point_center,
                                   display_this_square=False,
                                   row=1,
                                   column=0,
                                   access_difficulty=3,
                                   terrain_difficulty=4)
     self.grid_square.save()