def test_kml_simple(self):
        coordinates = [
            (0, -76.0, 38.0, 0.0, 0),
            (1, -76.0, 38.0, 10.0, 0),
            (2, -76.0, 38.0, 20.0, 0),
            (3, -76.0, 38.0, 30.0, 0),
            (4, -76.0, 38.0, 100.0, 0),
            (5, -76.0, 38.0, 30.0, 0),
            (6, -76.0, 38.0, 60.0, 0),
        ]
        # Create Coordinates
        start = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
        start.save()
        start.timestamp = self.now
        start.save()
        for coord in coordinates:
            self.create_log_element(*coord)
        end = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
        end.save()
        end.timestamp = self.now + datetime.timedelta(seconds=7)
        end.save()

        kml = Kml()
        UasTelemetry.kml(
            user=self.user,
            logs=UasTelemetry.by_user(self.user),
            kml=kml,
            kml_doc=kml.document)
        for coord in coordinates:
            tag = self.coord_format.format(coord[2], coord[1],
                                           units.feet_to_meters(coord[3]))
            self.assertTrue(tag in kml.kml())
示例#2
0
 def create_event(self, time, uas_in_air):
     """Create a TakeoffOrLandingEvent for test user."""
     event = TakeoffOrLandingEvent(user=self.user1, uas_in_air=uas_in_air)
     event.save()
     event.timestamp = time
     event.save()
     return event
 def create_event(self, time, uas_in_air):
     """Create a TakeoffOrLandingEvent for test user."""
     event = TakeoffOrLandingEvent(user=self.user1, uas_in_air=uas_in_air)
     event.save()
     event.timestamp = time
     event.save()
     return event
 def create_event(self, time, uas_in_air, mission=None):
     """Create a TakeoffOrLandingEvent for test user."""
     if mission is None:
         mission = self.mission
     event = TakeoffOrLandingEvent(
         user=self.user1, mission=mission, uas_in_air=uas_in_air)
     event.save()
     event.timestamp = time
     event.save()
     return event