示例#1
0
    def test_actionable_submission(self):
        """Tests actionable_submission correctly filters submissions."""
        # t1 created and updated before take off.
        t1 = Odlc(user=self.user, odlc_type=OdlcType.standard)
        t1.save()
        t1.alphanumeric = 'A'
        t1.save()

        # t2 created before take off and updated in flight.
        t2 = Odlc(user=self.user, odlc_type=OdlcType.standard)
        t2.save()

        event = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
        event.save()

        t2.alphanumeric = 'A'
        t2.save()

        # t3 created and updated in flight.
        t3 = Odlc(user=self.user, odlc_type=OdlcType.standard)
        t3.save()
        t3.alphanumeric = 'A'
        t3.save()

        # t4 created in flight and updated after landing.
        t4 = Odlc(user=self.user, odlc_type=OdlcType.standard)
        t4.save()

        event = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
        event.save()

        t4.alphanumeric = 'A'
        t4.save()

        # t5 created and updated after landing.
        t5 = Odlc(user=self.user, odlc_type=OdlcType.standard)
        t5.save()
        t5.alphanumeric = 'A'
        t5.save()

        # t6 created and updated in second flight.
        event = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
        event.save()
        t6 = Odlc(user=self.user, odlc_type=OdlcType.standard)
        t6.save()
        t6.alphanumeric = 'A'
        t6.save()
        event = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
        event.save()

        # t7 with actionable_override set.
        event = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
        event.save()
        event = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
        event.save()
        t7 = Odlc(
            user=self.user,
            odlc_type=OdlcType.standard,
            actionable_override=True)
        t7.save()

        self.assertFalse(t1.actionable_submission())
        self.assertFalse(t2.actionable_submission())
        self.assertTrue(t3.actionable_submission())
        self.assertFalse(t4.actionable_submission())
        self.assertFalse(t5.actionable_submission())
        self.assertFalse(t6.actionable_submission())
        self.assertTrue(t7.actionable_submission())
示例#2
0
    def test_actionable_submission(self):
        """Tests actionable_submission correctly filters submissions."""
        # t1 created and updated before take off.
        t1 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        t1.save()
        t1.alphanumeric = 'A'
        t1.update_last_modified()
        t1.save()

        # t2 created before take off and updated in flight.
        t2 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        t2.save()

        event = TakeoffOrLandingEvent(user=self.user,
                                      mission=self.mission,
                                      uas_in_air=True)
        event.save()

        t2.alphanumeric = 'A'
        t2.update_last_modified()
        t2.save()

        # t3 created and updated in flight.
        t3 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        t3.save()
        t3.alphanumeric = 'A'
        t3.update_last_modified()
        t3.save()

        # t4 created in flight and updated after landing.
        t4 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        t4.save()

        event = TakeoffOrLandingEvent(user=self.user,
                                      mission=self.mission,
                                      uas_in_air=False)
        event.save()

        t4.alphanumeric = 'A'
        t4.update_last_modified()
        t4.save()

        # t5 created and updated after landing.
        t5 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        t5.save()
        t5.alphanumeric = 'A'
        t5.update_last_modified()
        t5.save()

        # t6 created and updated in second flight.
        event = TakeoffOrLandingEvent(user=self.user,
                                      mission=self.mission,
                                      uas_in_air=True)
        event.save()
        t6 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        t6.save()
        t6.alphanumeric = 'A'
        t6.update_last_modified()
        t6.save()
        event = TakeoffOrLandingEvent(user=self.user,
                                      mission=self.mission,
                                      uas_in_air=False)
        event.save()

        # t7 which is not actionable.
        event = TakeoffOrLandingEvent(user=self.user,
                                      mission=self.mission,
                                      uas_in_air=True)
        event.save()
        t7 = Odlc(mission=self.mission,
                  user=self.user,
                  odlc_type=interop_api_pb2.Odlc.STANDARD)
        event = TakeoffOrLandingEvent(user=self.user,
                                      mission=self.mission,
                                      uas_in_air=False)
        event.save()

        flights = TakeoffOrLandingEvent.flights(self.mission, self.user)

        self.assertFalse(t1.actionable_submission(flights))
        self.assertFalse(t2.actionable_submission(flights))
        self.assertTrue(t3.actionable_submission(flights))
        self.assertFalse(t4.actionable_submission(flights))
        self.assertFalse(t5.actionable_submission(flights))
        self.assertFalse(t6.actionable_submission(flights))
        self.assertFalse(t7.actionable_submission(flights))