import unittest
from src.services.monitor.satellite_simulator import Satellite


class MyTestCase(unittest.TestCase):

    def test_default_elipsoidal_constructor(self):
        elpisoidal_satellite = Satellite(Satellite.ELIPSE_TRAJECTORY)
        self.assertTrue(hasattr(elpisoidal_satellite, 'trajectory'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'elipse_center_geo'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'a_km'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'b_km'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'flight_height'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'time_interval'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'random_center'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'num_points'))

        self.assertIsNotNone(elpisoidal_satellite.trajectory)
        self.assertIsNotNone(elpisoidal_satellite.elipse_center_geo)

    def test_default_elipsoidal_trajectory_constructor(self):
        elpisoidal_satellite = Satellite(Satellite.ELIPSE_TRAJECTORY)
        self.assertTrue(hasattr(elpisoidal_satellite, 'latitudes'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'longitudes'))
        self.assertTrue(hasattr(elpisoidal_satellite, 'heights'))

    def test_default_elipsoidal_trajectory_satellite_thread_initiation(self):
        elpisoidal_satellite = Satellite(Satellite.ELIPSE_TRAJECTORY)
        elpisoidal_satellite.iniciar_hilo()
        self.assertIsNotNone(elpisoidal_satellite.get_position())
        self.assertEqual(len(elpisoidal_satellite.get_position()), 3)

    def test_default_parabolic_constructor(self):
        parabolic_satellite = Satellite(Satellite.PARABOLIC_TRAJECTORY)
        self.assertTrue(hasattr(parabolic_satellite, 'trajectory'))
        self.assertTrue(hasattr(parabolic_satellite, 'parabolic_vertix'))
        self.assertTrue(hasattr(parabolic_satellite, 'focal_distance'))
        self.assertTrue(hasattr(parabolic_satellite, 'flight_time'))
        self.assertTrue(hasattr(parabolic_satellite, 'flight_height'))
        self.assertTrue(hasattr(parabolic_satellite, 'num_points'))
        self.assertTrue(hasattr(parabolic_satellite, 'time_interval'))

        self.assertIsNotNone(parabolic_satellite.trajectory)
        self.assertIsNotNone(parabolic_satellite.parabolic_vertix)

    def test_default_parabolic_trajectory_constructor(self):
        parabolic_satellite = Satellite(Satellite.PARABOLIC_TRAJECTORY)
        self.assertTrue(hasattr(parabolic_satellite, 'latitudes'))
        self.assertTrue(hasattr(parabolic_satellite, 'longitudes'))
        self.assertTrue(hasattr(parabolic_satellite, 'heights'))

    def test_default_parabolic_trajectory_satellite_thread_initiation(self):
        parabolic_satellite = Satellite(Satellite.PARABOLIC_TRAJECTORY)
        parabolic_satellite.iniciar_hilo()
        self.assertIsNotNone(parabolic_satellite.get_position())
        self.assertEqual(len(parabolic_satellite.get_position()), 3)

if __name__ == '__main__':
    unittest.main()
