Exemplo n.º 1
0
    def setUp(self):
        """Setup a single active mission to test live kml with."""
        super(TestGenerateLiveKMLNoFixture, self).setUp()

        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        info = ServerInfo()
        info.timestamp = timezone.now()
        info.message = "Hello World"
        info.save()

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.ir_primary_target_pos = pos
        config.ir_secondary_target_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        config.save()
        self.config = config
Exemplo n.º 2
0
    def setUp(self):
        self.user = User.objects.create_user("testuser", "*****@*****.**", "testpass")
        self.user.save()

        # Create an active mission.
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        info = ServerInfo()
        info.timestamp = datetime.datetime.now()
        info.message = "Hello World"
        info.save()
        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        config.save()

        # Add a couple of stationary obstacles
        obst = self.create_stationary_obstacle(lat=38.142233, lon=-76.434082, radius=300, height=500)
        config.stationary_obstacles.add(obst)

        obst = self.create_stationary_obstacle(lat=38.442233, lon=-76.834082, radius=100, height=750)
        config.stationary_obstacles.add(obst)

        # And a couple of moving obstacles
        obst = self.create_moving_obstacle(
            [
                # (lat,     lon,        alt)
                (38.142233, -76.434082, 300),
                (38.141878, -76.425198, 700),
            ]
        )
        config.moving_obstacles.add(obst)

        obst = self.create_moving_obstacle(
            [
                # (lat,     lon,        alt)
                (38.145405, -76.428310, 100),
                (38.146582, -76.424099, 200),
                (38.144662, -76.427634, 300),
                (38.147729, -76.419185, 200),
                (38.147573, -76.420832, 100),
                (38.148522, -76.419507, 750),
            ]
        )
        config.moving_obstacles.add(obst)

        config.save()

        # Login
        response = self.client.post(login_url, {"username": "******", "password": "******"})
        self.assertEqual(200, response.status_code)
Exemplo n.º 3
0
    def create_config(self):
        """Creates a dummy config for testing."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        info = ServerInfo()
        info.timestamp = datetime.datetime.now()
        info.message = "Hello World"
        info.save()

        config = MissionConfig()
        config.is_active = False
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        return config
Exemplo n.º 4
0
    def setUp(self):
        """Populates an active mission to test a cached view."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        self.pos = pos

        info = ServerInfo()
        info.timestamp = datetime.datetime.now()
        info.message = "Hello World"
        info.save()

        obst = StationaryObstacle()
        obst.gps_position = pos
        obst.cylinder_radius = 10
        obst.cylinder_height = 10
        obst.save()
        self.obst = obst

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.ir_primary_target_pos = pos
        config.ir_secondary_target_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        config.save()
        self.config = config
        config.stationary_obstacles.add(obst)
        config.save()

        self.login_url = reverse('auvsi_suas:login')
        self.obst_url = reverse('auvsi_suas:obstacles')
        self.clear_cache_url = reverse('auvsi_suas:clear_cache')
Exemplo n.º 5
0
    def setUp(self):
        """Setup a single active mission to test live kml with."""
        super(TestGenerateLiveKMLNoFixture, self).setUp()

        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()

        info = ServerInfo()
        info.timestamp = timezone.now()
        info.message = "Hello World"
        info.save()

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        config.save()
        self.config = config
Exemplo n.º 6
0
    def setUp(self):
        """Populates an active mission to test a cached view."""
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        self.pos = pos

        info = ServerInfo()
        info.timestamp = datetime.datetime.now()
        info.message = "Hello World"
        info.save()

        obst = StationaryObstacle()
        obst.gps_position = pos
        obst.cylinder_radius = 10
        obst.cylinder_height = 10
        obst.save()
        self.obst = obst

        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        config.save()
        self.config = config
        config.stationary_obstacles.add(obst)
        config.save()

        self.login_url = reverse('auvsi_suas:login')
        self.obst_url = reverse('auvsi_suas:obstacles')
        self.clear_cache_url = reverse('auvsi_suas:clear_cache')
Exemplo n.º 7
0
 def setUp(self):
     info = ServerInfo()
     info.timestamp = datetime.datetime.now()
     info.message = "Hello World"
     info.save()
     self.info = info
Exemplo n.º 8
0
 def setUp(self):
     info = ServerInfo()
     info.timestamp = datetime.datetime.now()
     info.message = "Hello World"
     info.save()
     self.info = info
Exemplo n.º 9
0
    def setUp(self):
        self.user = User.objects.create_user('testuser', '*****@*****.**',
                                             'testpass')
        self.user.save()

        # Create an active mission.
        pos = GpsPosition()
        pos.latitude = 10
        pos.longitude = 10
        pos.save()
        info = ServerInfo()
        info.timestamp = datetime.datetime.now()
        info.message = "Hello World"
        info.save()
        config = MissionConfig()
        config.is_active = True
        config.home_pos = pos
        config.emergent_last_known_pos = pos
        config.off_axis_target_pos = pos
        config.sric_pos = pos
        config.air_drop_pos = pos
        config.server_info = info
        config.save()

        # Add a couple of stationary obstacles
        obst = self.create_stationary_obstacle(lat=38.142233,
                                               lon=-76.434082,
                                               radius=300,
                                               height=500)
        config.stationary_obstacles.add(obst)

        obst = self.create_stationary_obstacle(lat=38.442233,
                                               lon=-76.834082,
                                               radius=100,
                                               height=750)
        config.stationary_obstacles.add(obst)

        # And a couple of moving obstacles
        obst = self.create_moving_obstacle([
            # (lat,     lon,        alt)
            (38.142233, -76.434082, 300),
            (38.141878, -76.425198, 700),
        ])
        config.moving_obstacles.add(obst)

        obst = self.create_moving_obstacle([
            # (lat,     lon,        alt)
            (38.145405, -76.428310, 100),
            (38.146582, -76.424099, 200),
            (38.144662, -76.427634, 300),
            (38.147729, -76.419185, 200),
            (38.147573, -76.420832, 100),
            (38.148522, -76.419507, 750),
        ])
        config.moving_obstacles.add(obst)

        config.save()

        # Login
        response = self.client.post(login_url, {
            'username': '******',
            'password': '******'
        })
        self.assertEqual(200, response.status_code)