Ejemplo n.º 1
0
 def test_mlp_occurrence_save_simple(self):
     """
     Test mlp_occurrence instance save method with the simplest possible attributes.
     """
     starting_record_count = Occurrence.objects.count()  # get current number of occurrence records
     # The simplest occurrence instance we can create needs six bits of data.
     # Using the instance creation and then save methods
     new_occurrence = Occurrence(id=1, item_type="Faunal", basis_of_record="HumanObservation",
                                 collecting_method="Surface Standard", field_number=datetime.now(),
                                 geom="POINT (40.8352906016 11.5303732536)")
     new_occurrence.save()
     now = datetime.now()
     self.assertEqual(Occurrence.objects.count(), starting_record_count+1)  # test that one record has been added
     self.assertEqual(new_occurrence.date_last_modified.day, now.day)  # test date last modified is correct
     self.assertEqual(new_occurrence.point_x(), 40.8352906016)
     self.assertEqual(new_occurrence.point_y(), 11.5303732536)
Ejemplo n.º 2
0
    def test_mlp_save_method_invalid_item_type(self):
        """
        """
        starting_record_count = Occurrence.objects.count()
        new_occurrence = Occurrence()
        new_occurrence.item_type = "Fake"
        new_occurrence.basis_of_record = "HumanObservation"
        new_occurrence.collecting_method = "Surface Standard"
        new_occurrence.field_number = datetime.now(pytz.utc)
        new_occurrence.geom = "POINT (40.8352906016 11.5303732536)"
        new_occurrence.save()

        now = datetime.now()
        self.assertEqual(Occurrence.objects.count(), starting_record_count +
                         1)  # test that one record has been added
        self.assertEqual(new_occurrence.date_last_modified.day,
                         now.day)  # test date last modified is correct
        self.assertEqual(new_occurrence.point_x(), 40.8352906016)
        self.assertEqual(new_occurrence.item_type, "Fake")
Ejemplo n.º 3
0
    def test_mlp_save_method_invalid_item_type(self):
        """
        """
        starting_record_count = Occurrence.objects.count()
        new_occurrence = Occurrence()
        new_occurrence.item_type = "Fake"
        new_occurrence.basis_of_record = "HumanObservation"
        new_occurrence.collecting_method = "Surface Standard"
        new_occurrence.field_number = datetime.now()
        new_occurrence.geom = "POINT (691311.7081000003963709 1272538.8992999996989965)"
        new_occurrence.save()

        now = datetime.now()
        self.assertEqual(Occurrence.objects.count(), starting_record_count +
                         1)  # test that one record has been added
        self.assertEqual(new_occurrence.date_last_modified.day,
                         now.day)  # test date last modified is correct
        self.assertEqual(new_occurrence.point_x(), 691311.7081000003963709)
        self.assertEqual(new_occurrence.item_type, "Fake")
Ejemplo n.º 4
0
    def test_mlp_save_method_invalid_item_type(self):
        """
        """
        starting_record_count = Occurrence.objects.count()
        new_occurrence = Occurrence()
        new_occurrence.item_type = "Fake"
        new_occurrence.basis_of_record = "HumanObservation"
        new_occurrence.collecting_method = "Surface Standard"
        new_occurrence.field_number = datetime.now()
        new_occurrence.geom = "POINT (40.8352906016 11.5303732536)"
        new_occurrence.save()

        now = datetime.now()
        self.assertEqual(Occurrence.objects.count(), starting_record_count+1)  # test that one record has been added
        self.assertEqual(new_occurrence.date_last_modified.day, now.day)  # test date last modified is correct
        self.assertEqual(new_occurrence.point_x(), 40.8352906016)
        self.assertEqual(new_occurrence.item_type, "Fake")
Ejemplo n.º 5
0
 def test_mlp_occurrence_save_simple(self):
     """
     Test mlp_occurrence instance save method with the simplest possible attributes.
     """
     starting_record_count = Occurrence.objects.count(
     )  # get current number of occurrence records
     # The simplest occurrence instance we can create needs six bits of data.
     # Using the instance creation and then save methods
     new_occurrence = Occurrence(
         id=1,
         item_type="Faunal",
         basis_of_record="HumanObservation",
         collecting_method="Surface Standard",
         field_number=datetime.now(),
         geom="POINT (691311.7081000003963709 1272538.8992999996989965)")
     new_occurrence.save()
     now = datetime.now()
     self.assertEqual(Occurrence.objects.count(), starting_record_count +
                      1)  # test that one record has been added
     self.assertEqual(new_occurrence.date_last_modified.day,
                      now.day)  # test date last modified is correct
     self.assertEqual(new_occurrence.point_x(), 691311.7081000003963709)
Ejemplo n.º 6
0
 def test_mlp_occurrence_save_simple(self):
     """
     Test mlp_occurrence instance save method with the simplest possible attributes.
     """
     starting_record_count = Occurrence.objects.count(
     )  # get current number of occurrence records
     new_occurrence = Occurrence(id=1,
                                 item_type="Faunal",
                                 basis_of_record="HumanObservation",
                                 collecting_method="Surface Standard",
                                 field_number=datetime.now(pytz.utc),
                                 geom="POINT (40.8352906016 11.5303732536)")
     new_occurrence.save()
     now = datetime.now()
     self.assertEqual(Occurrence.objects.count(), starting_record_count +
                      1)  # test that one record has been added
     self.assertEqual(new_occurrence.date_last_modified.day,
                      now.day)  # test date last modified is correct
     self.assertEqual(new_occurrence.point_x(), 40.8352906016)
     self.assertEqual(new_occurrence.point_y(), 11.5303732536)