def setUp(self): """Database setup for the tests. """ self.__verbose_testing = False satnet_settings.JRPC_PERMISSIONS = True self.__user = db_tools.create_user_profile() self.__request_1 = db_tools.create_request(user_profile=self.__user) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_1_id ) self.__gs_2_id = 'gs-calpoly' self.__gs_2 = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_2_id ) self.__admin = db_tools.create_user_profile( username='******', email='*****@*****.**', is_staff=True ) self.__request_2 = db_tools.create_request(user_profile=self.__admin) self.__leop_tle_l1 = db_tools.ISS_TLE[0] self.__leop_tle_l2 = db_tools.ISS_TLE[1] self.__leop_id = 'leop_cluster_4testing' self.__leop_date = pytz.utc.localize(datetime.datetime.today()) self.__leop = db_tools.create_launch( admin=self.__admin, identifier=self.__leop_id, date=self.__leop_date, tle_l1=self.__leop_tle_l1, tle_l2=self.__leop_tle_l2 ) self.__leop_serial_date = str(self.__leop.date.isoformat()) self.__leop_cs = launch_utils.generate_cluster_callsign(self.__leop_id) self.__leop_sc_id = launch_utils.generate_cluster_sc_identifier( self.__leop_id, self.__leop_cs ) self.__ufo_id = 1 self.__ufo_sc_id = launch_utils.generate_object_sc_identifier( self.__leop_id, self.__ufo_id ) self.__ufo_callsign = 'SCLLY' self.__ufo_tle_l1 = self.__leop_tle_l1 self.__ufo_tle_l2 = self.__leop_tle_l2 self.__leop_2_tle_l1 = db_tools.TIANGONG_TLE[0] self.__leop_2_tle_l2 = db_tools.TIANGONG_TLE[1] if not self.__verbose_testing: logging.getLogger('leop').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) # noinspection PyUnresolvedReferences from services.scheduling.signals import compatibility self.__gs_1_id = 'uvigo' self.__gs_1_ch_1_id = 'qpsk-gs-1' self.__gs_1_ch_2_id = 'qpsk-gs-2' self.__gs_2_id = 'calpoly' self.__sc_1_id = 'humd' self.__sc_1_ch_1_id = 'gmsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_2_id = 'gmsk-sc-2' self.__sc_2_id = 'beesat' self.__band = db_tools.create_band() self.__test_user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id ) self.__gs_2 = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_2_id, ) self.__sc_1 = db_tools.create_sc( user_profile=self.__test_user_profile, identifier=self.__sc_1_id ) self.__sc_2 = db_tools.create_sc( user_profile=self.__test_user_profile, identifier=self.__sc_2_id ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, )
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'uvigo' self.__gs_1_ch_1_id = 'qpsk-gs-1' self.__gs_1_ch_2_id = 'qpsk-gs-2' self.__gs_2_id = 'calpoly' self.__sc_1_id = 'humd' self.__sc_1_ch_1_id = 'gmsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_2_id = 'gmsk-sc-2' self.__sc_2_id = 'beesat' self.__band = db_tools.create_band() self.__test_user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs_1, self.__band, self.__gs_1_ch_1_id) self.__gs_2 = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_2_id, ) self.__sc_1 = db_tools.create_sc(user_profile=self.__test_user_profile, identifier=self.__sc_1_id) self.__sc_2 = db_tools.create_sc(user_profile=self.__test_user_profile, identifier=self.__sc_2_id) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, ) if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
def setUp(self): """Database setup for the tests. """ self.__verbose_testing = False satnet_settings.JRPC_PERMISSIONS = True self.__user = db_tools.create_user_profile() self.__request_1 = db_tools.create_request(user_profile=self.__user) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs(user_profile=self.__user, identifier=self.__gs_1_id) self.__gs_2_id = 'gs-calpoly' self.__gs_2 = db_tools.create_gs(user_profile=self.__user, identifier=self.__gs_2_id) self.__admin = db_tools.create_user_profile(username='******', email='*****@*****.**', is_staff=True) self.__request_2 = db_tools.create_request(user_profile=self.__admin) self.__leop_tle_l1 = db_tools.ISS_TLE[0] self.__leop_tle_l2 = db_tools.ISS_TLE[1] self.__leop_id = 'leop_cluster_4testing' self.__leop_date = pytz.utc.localize(datetime.datetime.today()) self.__leop = db_tools.create_launch(admin=self.__admin, identifier=self.__leop_id, date=self.__leop_date, tle_l1=self.__leop_tle_l1, tle_l2=self.__leop_tle_l2) self.__leop_serial_date = str(self.__leop.date.isoformat()) self.__leop_cs = launch_utils.generate_cluster_callsign(self.__leop_id) self.__leop_sc_id = launch_utils.generate_cluster_sc_identifier( self.__leop_id, self.__leop_cs) self.__ufo_id = 1 self.__ufo_sc_id = launch_utils.generate_object_sc_identifier( self.__leop_id, self.__ufo_id) self.__ufo_callsign = 'SCLLY' self.__ufo_tle_l1 = self.__leop_tle_l1 self.__ufo_tle_l2 = self.__leop_tle_l2 self.__leop_2_tle_l1 = db_tools.TIANGONG_TLE[0] self.__leop_2_tle_l2 = db_tools.TIANGONG_TLE[1] if not self.__verbose_testing: logging.getLogger('leop').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
def setUp(self): self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'uvigo' self.__gs_1_ch_1_id = 'qpsk-gs-1' self.__sc_1_id = 'xatcobe-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'qpsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__band = db_tools.create_band() self.__test_user_profile = db_tools.create_user_profile() self.__simulator = simulation.OrbitalSimulator() self.__gs_1 = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_1_id, contact_elevation=0, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id ) self.__sc_1 = db_tools.create_sc( user_profile=self.__test_user_profile, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, )
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__sc_1_id = 'sc-xatcobeo' self.__sc_1_ch_1_id = 'xatco-fm-1' self.__sc_1_ch_2_id = 'xatco-fm-2' self.__sc_1_ch_3_id = 'xatco-fm-3' self.__sc_1_ch_4_id = 'xatco-afsk-1' self.__band = sn_helpers.create_band() self.__test_user_profile = sn_helpers.create_user_profile() self.__gs = sn_helpers.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_1_id, ) self.__sc = sn_helpers.create_sc( user_profile=self.__test_user_profile, identifier=self.__sc_1_id )
def test_passes(self): """UNIT test: services.common.simualtion.passes """ self.__tle_fb = tle_models.TwoLineElement.objects.create( 'testingsource', db_tools.ISS_TLE_ID, db_tools.ISS_TLE[0], db_tools.ISS_TLE[1] ) self.__sc_fb = db_tools.create_sc( user_profile=self.__test_user_profile, tle_id=db_tools.ISS_TLE_ID ) self.__gs_uvigo_id = 'uvigo-gs' self.__gs_uvigo_e = 0 self.__gs_uvigo_lat = 42.170075 self.__gs_uvigo_lng = -8.68826 self.__gs_uvigo = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_uvigo_id, latitude=self.__gs_uvigo_lat, longitude=self.__gs_uvigo_lng, contact_elevation=self.__gs_uvigo_e ) self.__simulator.set_spacecraft(self.__tle_fb) self.__simulator.set_groundstation(self.__gs_uvigo) window = self.__simulator.get_simulation_window() # noinspection PyUnusedLocal slots = self.__simulator.calculate_pass_slot(window[0], window[1])
def setUp(self): """Test setup This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) self.__user = db_tools.create_user_profile() self.__request_1 = db_tools.create_request(user_profile=self.__user) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs(user_profile=self.__user, identifier=self.__gs_1_id) self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'CANX-2' self.__sc_1 = db_tools.create_sc( user_profile=self.__user, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, )
def setUp(self): self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__sc_1_id = 'sc-xatcobeo' self.__sc_1_ch_1_id = 'xatco-fm-1' self.__sc_1_ch_1_f = 437000000 from services.configuration.signals import tle from services.scheduling.signals import compatibility from services.scheduling.signals import availability self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id ) self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, )
def test_firebird(self): """UNIT test: Firebird TLE bug Test carried out to find what is the problem with the Firebird TLE and UVIGO groundstation. """ self.__tle_fb = tle_models.TwoLineElement.objects.create( 'testingsource', db_tools.ISS_TLE_ID, db_tools.ISS_TLE[0], db_tools.ISS_TLE[1] ) self.__sc_fb = db_tools.create_sc( user_profile=self.__user, tle_id=db_tools.ISS_TLE_ID ) self.__gs_uvigo_id = 'uvigo-gs' self.__gs_uvigo_e = 0 self.__gs_uvigo_lat = 42.170075 self.__gs_uvigo_lng = -8.68826 self.__gs_uvigo = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_uvigo_id, latitude=self.__gs_uvigo_lat, longitude=self.__gs_uvigo_lng, contact_elevation=self.__gs_uvigo_e )
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__sc_1_id = 'sc-xatcobeo' self.__sc_1_ch_1_id = 'xatco-fm-1' self.__sc_1_ch_2_id = 'xatco-fm-2' self.__sc_1_ch_3_id = 'xatco-fm-3' self.__sc_1_ch_4_id = 'xatco-afsk-1' self.__band = sn_helpers.create_band() self.__test_user_profile = sn_helpers.create_user_profile() self.__gs = sn_helpers.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_1_id, ) self.__sc = sn_helpers.create_sc(user_profile=self.__test_user_profile, identifier=self.__sc_1_id)
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) # noinspection PyUnresolvedReferences from services.scheduling.signals import compatibility self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__gs_1_ch_2_id = 'chan-cas-2' self.__gs_1_ch_3_id = 'chan-cas-3' self.__sc_1_id = 'sc-xatcobeo' self.__sc_1_ch_1_id = 'xatco-fm-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_2_id = 'xatco-fm-2' self.__sc_1_ch_3_id = 'xatco-fm-3' self.__sc_1_ch_4_id = 'xatco-afsk-1' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__sc = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id )
def setUp(self): """Test setup This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) self.__user = db_tools.create_user_profile() self.__request_1 = db_tools.create_request(user_profile=self.__user) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_1_id ) self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'CANX-2' self.__sc_1 = db_tools.create_sc( user_profile=self.__user, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, )
def setUp(self): """ This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False self.__test_slot_id = -1 self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'gmsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = 'gs-la-fm' self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs_1, self.__band, self.__gs_1_ch_1_id) self.__rule_1 = jrpc_rules.add_rule( self.__gs_1_id, db_tools.create_jrpc_daily_rule( date_i=sn_misc.get_today_utc(), date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50), starting_time=sn_misc.get_next_midnight() + datetime.timedelta(seconds=1), ending_time=sn_misc.get_next_midnight() + datetime.timedelta(hours=23, minutes=59, seconds=59)))
def setUp(self): """ This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('common').setLevel(level=logging.CRITICAL) logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) # noinspection PyUnresolvedReferences from services.scheduling.signals import availability self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = str('xatcobeo-fm') self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = str('gs-la-fm') self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__gs_1_ch_2_id = 'gs-la-fm-2' self.__gs_1_ch_2_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) operational_models.OperationalSlot.objects.set_debug()
def setUp(self): """Database setup for the tests. """ self.__verbose_testing = False self.__user = db_tools.create_user_profile() self.__request = db_tools.create_request(user_profile=self.__user) self.__user_no_gs = db_tools.create_user_profile(username='******') self.__request_ung = db_tools.create_request( user_profile=self.__user_no_gs ) self.__user_gs_2 = db_tools.create_user_profile(username='******') self.__request_gs_2 = db_tools.create_request( user_profile=self.__user_gs_2 ) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_1_id ) self.__gs_2_id = 'gs-calpoly' self.__gs_2 = db_tools.create_gs( user_profile=self.__user_gs_2, identifier=self.__gs_2_id ) self.__short_message = 'QWxhZGRpbjpvcGVuIHNlc2FtZQ==' self.__long_message = 'ogAAAABErEarAAAAAESsRwoAAAAARKxHaAAAAABErEfGAA' \ 'AAAESsSCVCE4y4RKxIg0NICpdErEjhQ4IvIkSsSUBDKx7d' \ 'RKxJngAAAABErEn8AAAAAESsSloAAAAARKxKuQAAAABEtQ' \ 'kRAAAAAES1CXkAAAAARLUJ4QAAAABEtQpKAAAAAES1CrJD' \ 'JhD9RLULGkN2IZtEtQuCQ0j6M0S1C' self.__b64_message = base64.b64encode( b'Base64 is a group of similar binary-to-text encoding schemes ' b'that represent binary data in an ASCII string format by ' b'translating it into a radix-64 representation. The term Base64 ' b'originates from a specific MIME content transfer encoding.' ) if not self.__verbose_testing: logging.getLogger('communications').setLevel(level=logging.CRITICAL)
def setUp(self): """Database setup for the tests. """ self.__verbose_testing = False self.__user = db_tools.create_user_profile() self.__request = db_tools.create_request(user_profile=self.__user) self.__user_no_gs = db_tools.create_user_profile(username='******') self.__request_ung = db_tools.create_request( user_profile=self.__user_no_gs) self.__user_gs_2 = db_tools.create_user_profile(username='******') self.__request_gs_2 = db_tools.create_request( user_profile=self.__user_gs_2) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs(user_profile=self.__user, identifier=self.__gs_1_id) self.__gs_2_id = 'gs-calpoly' self.__gs_2 = db_tools.create_gs(user_profile=self.__user_gs_2, identifier=self.__gs_2_id) self.__short_message = 'QWxhZGRpbjpvcGVuIHNlc2FtZQ==' self.__long_message = 'ogAAAABErEarAAAAAESsRwoAAAAARKxHaAAAAABErEfGAA' \ 'AAAESsSCVCE4y4RKxIg0NICpdErEjhQ4IvIkSsSUBDKx7d' \ 'RKxJngAAAABErEn8AAAAAESsSloAAAAARKxKuQAAAABEtQ' \ 'kRAAAAAES1CXkAAAAARLUJ4QAAAABEtQpKAAAAAES1CrJD' \ 'JhD9RLULGkN2IZtEtQuCQ0j6M0S1C' self.__b64_message = base64.b64encode( b'Base64 is a group of similar binary-to-text encoding schemes ' b'that represent binary data in an ASCII string format by ' b'translating it into a radix-64 representation. The term Base64 ' b'originates from a specific MIME content transfer encoding.') if not self.__verbose_testing: logging.getLogger('communications').setLevel( level=logging.CRITICAL)
def setUp(self): self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) self.__rule_date = misc.get_today_utc() self.__rule_s_time = misc.get_today_utc().replace( hour=12, minute=0, second=0, microsecond=0 ) self.__rule_e_time = self.__rule_s_time + datetime.timedelta(hours=5) self.__utc_s_date = self.__rule_date - datetime.timedelta(days=1) self.__utc_e_date = self.__rule_date + datetime.timedelta(days=365) self.__utc_s_time = self.__rule_s_time self.__utc_e_time = self.__rule_e_time self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__gs_2_id = 'gs-cuvi' # noinspection PyUnresolvedReferences from services.scheduling.signals import availability, compatibility self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__gs_2 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_2_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs, self.__band, self.__gs_1_ch_1_id )
def setUp(self): self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__gs_2_id = 'gs-cuvi' self.__band = sn_helpers.create_band() self.__user_profile = sn_helpers.create_user_profile() self.__gs = sn_helpers.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, )
def setUp(self): self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs, self.__band, self.__gs_1_ch_1_id)
def setUp(self): self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs, self.__band, self.__gs_1_ch_1_id )
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_id = 'uvigo' self.__gs_ch_1_id = 'qpsk-gs-1' self.__gs_ch_2_id = 'qpsk-gs-2' self.__sc_id = 'humd' self.__sc_ch_1_id = 'gmsk-sc-1' self.__sc_ch_f = 437000000 self.__sc_ch_2_id = 'gmsk-sc-2' self.__sc_id = 'beesat' self.__band = db_tools.create_band() self.__test_user_profile = db_tools.create_user_profile() self.__gs = db_tools.create_gs( user_profile=self.__test_user_profile, identifier=self.__gs_id, ) self.__gs_ch_1 = db_tools.gs_add_channel( self.__gs, self.__band, self.__gs_ch_1_id ) self.__gs_ch_2 = db_tools.gs_add_channel( self.__gs, self.__band, self.__gs_ch_2_id ) self.__sc = db_tools.create_sc( user_profile=self.__test_user_profile, identifier=self.__sc_id ) self.__sc_ch_1 = db_tools.sc_add_channel( self.__sc, self.__sc_ch_f, self.__sc_ch_1_id, ) self.__sc_ch_2 = db_tools.sc_add_channel( self.__sc, self.__sc_ch_f, self.__sc_ch_2_id, )
def setUp(self): """Database setup for the tests. """ self.__verbose_testing = False self.__user = db_tools.create_user_profile() self.__request_1 = db_tools.create_request(user_profile=self.__user) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_1_id ) self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'CANX-2' self.__sc_1 = db_tools.create_sc( user_profile=self.__user, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, )
def setUp(self): """Database setup for the tests. """ self.__verbose_testing = False self.__user = sn_helpers.create_user_profile() self.__request_1 = sn_helpers.create_request(user_profile=self.__user) self.__gs_1_id = 'gs-uvigo' self.__gs_1 = sn_helpers.create_gs(user_profile=self.__user, identifier=self.__gs_1_id) self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'CANX-2' self.__sc_1 = sn_helpers.create_sc( user_profile=self.__user, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, )
def setUp(self): """Test setup Initial database configuration for the tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('common').setLevel(level=logging.CRITICAL) logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_callsign = 'GS1GSGS' self.__gs_1_contact_elevation = 10.30 self.__gs_1_longitude = -8.9330 self.__gs_1_latitude = 42.6000 self.__gs_1_configuration = ( self.__gs_1_callsign, 10.3, self.__gs_1_latitude, self.__gs_1_longitude ) self.__gs_1_ch_1_id = 'fm-1' self.__gs_1_ch_2_id = 'afsk-2' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__http_request = db_tools.create_request( user_profile=self.__user_profile ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, callsign=self.__gs_1_callsign, contact_elevation=self.__gs_1_contact_elevation, latitude=self.__gs_1_latitude, longitude=self.__gs_1_longitude, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id, )
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = True if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('django.db.backends.schema')\ .setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__gs_1_ch_2_id = 'chan-cas-2' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id ) self.__gs_1_ch_2 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_2_id ) self.__sc_1_id = 'humd' self.__sc_1_ch_1_id = 'gmsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_2_id = 'gmsk-sc-2' self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, )
def setUp(self): """ Populates the initial database with a set of objects required to run the following tests. """ self.__verbose_testing = True if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('django.db.backends.schema')\ .setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_ch_1_id = 'chan-cas-1' self.__gs_1_ch_2_id = 'chan-cas-2' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs_1, self.__band, self.__gs_1_ch_1_id) self.__gs_1_ch_2 = db_tools.gs_add_channel(self.__gs_1, self.__band, self.__gs_1_ch_2_id) self.__sc_1_id = 'humd' self.__sc_1_ch_1_id = 'gmsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_2_id = 'gmsk-sc-2' self.__sc_1 = db_tools.create_sc(user_profile=self.__user_profile, identifier=self.__sc_1_id) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, )
def test_firebird(self): """UNIT test: Firebird TLE bug Test carried out to find what is the problem with the Firebird TLE and UVIGO groundstation. """ self.__tle_fb = tle_models.TwoLineElement.objects.create( 'testingsource', db_tools.ISS_TLE_ID, db_tools.ISS_TLE[0], db_tools.ISS_TLE[1]) self.__sc_fb = db_tools.create_sc(user_profile=self.__user, tle_id=db_tools.ISS_TLE_ID) self.__gs_uvigo_id = 'uvigo-gs' self.__gs_uvigo_e = 0 self.__gs_uvigo_lat = 42.170075 self.__gs_uvigo_lng = -8.68826 self.__gs_uvigo = db_tools.create_gs( user_profile=self.__user, identifier=self.__gs_uvigo_id, latitude=self.__gs_uvigo_lat, longitude=self.__gs_uvigo_lng, contact_elevation=self.__gs_uvigo_e)
def setUp(self): """Test setup Initial database configuration for the tests. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('common').setLevel(level=logging.CRITICAL) logging.getLogger('configuration').setLevel(level=logging.CRITICAL) self.__gs_1_id = 'gs-castrelos' self.__gs_1_callsign = 'GS1GSGS' self.__gs_1_contact_elevation = 10.30 self.__gs_1_longitude = -8.9330 self.__gs_1_latitude = 42.6000 self.__gs_1_configuration = (self.__gs_1_callsign, 10.3, self.__gs_1_latitude, self.__gs_1_longitude) self.__gs_1_ch_1_id = 'fm-1' self.__gs_1_ch_2_id = 'afsk-2' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__http_request = db_tools.create_request( user_profile=self.__user_profile) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, callsign=self.__gs_1_callsign, contact_elevation=self.__gs_1_contact_elevation, latitude=self.__gs_1_latitude, longitude=self.__gs_1_longitude, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id, )
def setUp(self): """ This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False self.__test_slot_id = -1 self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'gmsk-sc-1' self.__sc_1_ch_1_f = 437000000 self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = 'gs-la-fm' self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id ) self.__rule_1 = jrpc_rules.add_rule( self.__gs_1_id, db_tools.create_jrpc_daily_rule( date_i=sn_misc.get_today_utc(), date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50), starting_time=sn_misc.get_next_midnight() + datetime.timedelta( seconds=1 ), ending_time=sn_misc.get_next_midnight() + datetime.timedelta( hours=23, minutes=59, seconds=59 ) ) )
def setUp(self): """ This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('common').setLevel(level=logging.CRITICAL) logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) operational.OperationalSlot.objects.set_debug() self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'xatcobeo-fm' self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = 'gs-la-fm' self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__gs_1_ch_2_id = 'gs-la-fm-2' self.__gs_1_ch_2_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.assertEqual( jrpc_gs_chs.gs_channel_create(groundstation_id=self.__gs_1_id, channel_id=self.__gs_1_ch_1_id, configuration=self.__gs_1_ch_1_cfg), True, 'Channel should have been created!') self.assertRaises(Exception, jrpc_gs_scheduling.get_operational_slots, self.__gs_1_ch_1_id) # 3) basic test, should generate 2 FREE slots self.assertEqual( jrpc_sc_chs.sc_channel_create(spacecraft_id=self.__sc_1_id, channel_id=self.__sc_1_ch_1_id, configuration=self.__sc_1_ch_1_cfg), True, 'Channel should have been created!') # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC # all pass slots should became operational slots. self.__rule_1 = jrpc_rules.add_rule( self.__gs_1_id, db_tools.create_jrpc_daily_rule( date_i=misc.get_today_utc(), date_f=misc.get_today_utc() + datetime.timedelta(days=50), starting_time=misc.get_next_midnight() + datetime.timedelta(seconds=1), ending_time=misc.get_next_midnight() + datetime.timedelta(hours=23, minutes=59, seconds=59)))
def setUp(self): """Test setup This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False self.__gs_1_id = 'gs-castrelos' self.__gs_1_callsign = 'GS1GSGS' self.__gs_1_contact_elevation = 10.30 self.__gs_1_longitude = -8.9330 self.__gs_1_latitude = 42.6000 self.__gs_1_configuration = ( self.__gs_1_callsign, 10.3, self.__gs_1_latitude, self.__gs_1_longitude ) self.__gs_2_id = 'gs-calpoly' self.__gs_1_ch_1_id = 'fm-1' self.__gs_1_ch_2_id = 'afsk-2' self.__sc_1_id = 'sc-xatcobeo' self.__sc_1_callsign = 'BABA00' self.__sc_1_tle_id = str('HUMSAT-D') self.__sc_1_ch_1_id = 'xatcobeo-qpsk-1' self.__sc_1_ch_2_id = 'xatcobeo-gmsk-2' self.__sc_1_ch_1_f = 437000000 self.__sc_1_configuration = ( self.__sc_1_callsign, self.__sc_1_tle_id ) self.__sc_2_id = 'sc-swisscube' self.__sc_2_tle_id = str('SWISSCUBE') self.__sc_3_id = 'sc-somp' self.__sc_3_tle_id = str('SOMP') self.__sc_4_id = 'sc-test' self.__sc_4_callsign = 'GOXX5' self.__sc_4_tle_id = 'GOES 4 [-]' self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__http_request = db_tools.create_request( user_profile=self.__user_profile ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, callsign=self.__gs_1_callsign, contact_elevation=self.__gs_1_contact_elevation, latitude=self.__gs_1_latitude, longitude=self.__gs_1_longitude, ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs_1, self.__band, self.__gs_1_ch_1_id, ) self.__gs_2 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_2_id ) self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id, callsign=self.__sc_1_callsign, tle_id=self.__sc_1_tle_id ) self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc_1, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id, ) self.__sc_2 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_2_id, tle_id=self.__sc_2_tle_id ) if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('simulation').setLevel(level=logging.CRITICAL) logging.getLogger('common').setLevel(level=logging.CRITICAL)
def setUp(self): """ This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) self.__rule_1_cfg = db_tools.create_jrpc_daily_rule( starting_time=misc.localize_time_utc(datetime.time( hour=8, minute=0, second=0 )), ending_time=misc.localize_time_utc(datetime.time( hour=23, minute=55, second=0 )) ) self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'xatcobeo-fm' self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = 'gs-la-fm' self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__gs_1_ch_2_id = 'gs-la-fm-2' self.__gs_1_ch_2_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } # noinspection PyUnresolvedReferences from services.scheduling.signals import availability # noinspection PyUnresolvedReferences from services.scheduling.signals import compatibility # noinspection PyUnresolvedReferences from services.scheduling.signals import operational self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, )
def setUp(self): """Database setup """ self.__verbose_testing = False self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'xatcobeo-fm' self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = 'gs-la-fm' self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__gs_1_ch_2_id = 'gs-la-fm-2' self.__gs_1_ch_2_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__sc_1 = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id, tle_id=self.__sc_1_tle_id, ) self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, ) self.assertEqual( jrpc_gs_chs.gs_channel_create( groundstation_id=self.__gs_1_id, channel_id=self.__gs_1_ch_1_id, configuration=self.__gs_1_ch_1_cfg ), True, 'Channel should have been created!' ) self.assertRaises( Exception, jrpc_gs_scheduling.get_operational_slots, self.__gs_1_ch_1_id ) # 3) basic test, should generate 2 FREE slots self.assertEqual( jrpc_sc_chs.sc_channel_create( spacecraft_id=self.__sc_1_id, channel_id=self.__sc_1_ch_1_id, configuration=self.__sc_1_ch_1_cfg ), True, 'Channel should have been created!' ) # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC # all pass slots should became operational slots. self.__rule_1 = jrpc_rules.add_rule( self.__gs_1_id, db_tools.create_jrpc_daily_rule( date_i=misc.get_today_utc(), date_f=misc.get_today_utc() + datetime.timedelta(days=50), starting_time=misc.get_next_midnight() + datetime.timedelta( seconds=1 ), ending_time=misc.get_next_midnight() + datetime.timedelta( hours=23, minutes=59, seconds=59 ) ) )
def setUp(self): """ This method populates the database with some information to be used only for this test. """ self.__verbose_testing = False if not self.__verbose_testing: logging.getLogger('configuration').setLevel(level=logging.CRITICAL) logging.getLogger('scheduling').setLevel(level=logging.CRITICAL) self.__rule_1_cfg = db_tools.create_jrpc_daily_rule( starting_time=misc.localize_time_utc( datetime.time(hour=8, minute=0, second=0)), ending_time=misc.localize_time_utc( datetime.time(hour=23, minute=55, second=0))) self.__sc_1_id = 'xatcobeo-sc' self.__sc_1_tle_id = 'HUMSAT-D' self.__sc_1_ch_1_id = 'xatcobeo-fm' self.__sc_1_ch_1_cfg = { channel_serializers.FREQUENCY_K: '437000000', channel_serializers.MODULATION_K: 'FM', channel_serializers.POLARIZATION_K: 'LHCP', channel_serializers.BITRATE_K: '300', channel_serializers.BANDWIDTH_K: '12.500000000' } self.__gs_1_id = 'gs-la' self.__gs_1_ch_1_id = 'gs-la-fm' self.__gs_1_ch_1_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } self.__gs_1_ch_2_id = 'gs-la-fm-2' self.__gs_1_ch_2_cfg = { channel_serializers.BAND_K: 'UHF / U / 435000000.000000 / 438000000.000000', channel_serializers.AUTOMATED_K: False, channel_serializers.MODULATIONS_K: ['FM'], channel_serializers.POLARIZATIONS_K: ['LHCP'], channel_serializers.BITRATES_K: [300, 600, 900], channel_serializers.BANDWIDTHS_K: [12.500000000, 25.000000000] } # noinspection PyUnresolvedReferences from services.scheduling.signals import availability # noinspection PyUnresolvedReferences from services.scheduling.signals import compatibility # noinspection PyUnresolvedReferences from services.scheduling.signals import operational self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() self.__gs_1 = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id, )
def test_bug_1(self): """INTR test: services.scheduling - operational slot generation """ self.__gs_1_id = 'gs-vigo' self.__gs_1_ch_1_id = 'chan-cas-1' self.__sc_1_id = 'sc-serpens' self.__sc_1_ch_1_id = 'xatco-fm-1' self.__sc_1_ch_1_f = 437500000 self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() # 1) create vigo gs self.__gs = db_tools.create_gs( user_profile=self.__user_profile, identifier=self.__gs_1_id ) # CHECK A: NO ADDITIONAL pass slots, no operational slots # ### There are pass slots for the already-propagated spacecraft p_slots_0 = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id ) self.assertEqual(len(p_slots_0), 0) o_slots_0 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_0 ) self.assertEqual(len(o_slots_0), 0) # 2) serpens spacecraft self.__sc = db_tools.create_sc( user_profile=self.__user_profile, identifier=self.__sc_1_id ) # CHECK B: MORE pass slots, no operational slots # ### There are pass slots for the already-propagated spacecraft p_slots_1 = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id ) self.assertGreater(len(p_slots_1), len(p_slots_0)) o_slots_0 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_0 ) self.assertEqual(len(o_slots_0), 0) # 3) we add channels and, therefore, compatibility matches # without availability rules, no operational slots self.__sc_1_ch_1 = db_tools.sc_add_channel( self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id ) self.__gs_1_ch_1 = db_tools.gs_add_channel( self.__gs, self.__band, self.__gs_1_ch_1_id ) # CHECK C: SAME pass slots, no operational slots # ### There are pass slots for the already-propagated spacecraft p_slots_2 = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id ) self.assertEqual(len(p_slots_2), len(p_slots_1)) o_slots_0 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_0 ) self.assertEqual(len(o_slots_0), 0) # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC # all pass slots should became operational slots. self.__rule_1 = rules_jrpc.add_rule( self.__gs_1_id, db_tools.create_jrpc_daily_rule( date_i=sn_misc.get_today_utc(), date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50), starting_time=sn_misc.get_next_midnight() + datetime.timedelta( seconds=1 ), ending_time=sn_misc.get_next_midnight() + datetime.timedelta( hours=23, minutes=59, seconds=59 ) ) ) # CHECK D: 3 availability slots (1 per day, almost 24 hours) # should transform all pass slots into operational slots a_slots = availability_models.AvailabilitySlot.objects.values_list( 'start', 'end' ) x_slots = [ ( sn_misc.get_today_utc() + datetime.timedelta( seconds=1 ), sn_misc.get_today_utc() + datetime.timedelta( hours=23, minutes=59, seconds=59 ) ), ( sn_misc.get_today_utc() + datetime.timedelta( days=1, seconds=1 ), sn_misc.get_today_utc() + datetime.timedelta( days=1, hours=23, minutes=59, seconds=59 ) ), ( sn_misc.get_today_utc() + datetime.timedelta( days=2, seconds=1 ), sn_misc.get_today_utc() + datetime.timedelta( days=2, hours=23, minutes=59, seconds=59 ) ) ] self.assertCountEqual(a_slots, x_slots) p_slots_applicable_objs = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id, start__gte=sn_misc.get_now_utc() ) p_slots_applicable = p_slots_applicable_objs.values_list( 'start', 'end' ) self.assertGreaterEqual(len(p_slots_2), len(p_slots_applicable)) o_slots_1 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_applicable_objs, state=operational_models.STATE_FREE ).values_list('start', 'end') self.assertCountEqual(p_slots_applicable, o_slots_1) # CHECK E: RPC interface should return an equivalent set of slots: o_slots_gs = gs_ops_rpc.get_operational_slots(self.__gs_1_id) self.assertEqual(len(o_slots_gs[self.__sc_1_id]), len(o_slots_1)) if self.__verbose_testing: sn_misc.print_list(o_slots_1, name='o_slots_1') sn_misc.print_list( o_slots_gs[self.__sc_1_id], name='o_slots-' + self.__gs_1_id )
def test_bug_1(self): """INTR test: services.scheduling - operational slot generation """ self.__gs_1_id = 'gs-vigo' self.__gs_1_ch_1_id = 'chan-cas-1' self.__sc_1_id = 'sc-serpens' self.__sc_1_ch_1_id = 'xatco-fm-1' self.__sc_1_ch_1_f = 437500000 self.__band = db_tools.create_band() self.__user_profile = db_tools.create_user_profile() # 1) create vigo gs self.__gs = db_tools.create_gs(user_profile=self.__user_profile, identifier=self.__gs_1_id) # CHECK A: NO ADDITIONAL pass slots, no operational slots # ### There are pass slots for the already-propagated spacecraft p_slots_0 = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id) self.assertEqual(len(p_slots_0), 0) o_slots_0 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_0) self.assertEqual(len(o_slots_0), 0) # 2) serpens spacecraft self.__sc = db_tools.create_sc(user_profile=self.__user_profile, identifier=self.__sc_1_id) # CHECK B: MORE pass slots, no operational slots # ### There are pass slots for the already-propagated spacecraft p_slots_1 = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id) self.assertGreater(len(p_slots_1), len(p_slots_0)) o_slots_0 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_0) self.assertEqual(len(o_slots_0), 0) # 3) we add channels and, therefore, compatibility matches # without availability rules, no operational slots self.__sc_1_ch_1 = db_tools.sc_add_channel(self.__sc, self.__sc_1_ch_1_f, self.__sc_1_ch_1_id) self.__gs_1_ch_1 = db_tools.gs_add_channel(self.__gs, self.__band, self.__gs_1_ch_1_id) # CHECK C: SAME pass slots, no operational slots # ### There are pass slots for the already-propagated spacecraft p_slots_2 = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id) self.assertEqual(len(p_slots_2), len(p_slots_1)) o_slots_0 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_0) self.assertEqual(len(o_slots_0), 0) # 4) we add a daily rule 12 hours, 00:00:01am to 11:59:59pm UTC # all pass slots should became operational slots. self.__rule_1 = rules_jrpc.add_rule( self.__gs_1_id, db_tools.create_jrpc_daily_rule( date_i=sn_misc.get_today_utc(), date_f=sn_misc.get_today_utc() + datetime.timedelta(days=50), starting_time=sn_misc.get_next_midnight() + datetime.timedelta(seconds=1), ending_time=sn_misc.get_next_midnight() + datetime.timedelta(hours=23, minutes=59, seconds=59))) # CHECK D: 3 availability slots (1 per day, almost 24 hours) # should transform all pass slots into operational slots a_slots = availability_models.AvailabilitySlot.objects.values_list( 'start', 'end') x_slots = [ (sn_misc.get_today_utc() + datetime.timedelta(seconds=1), sn_misc.get_today_utc() + datetime.timedelta(hours=23, minutes=59, seconds=59)), (sn_misc.get_today_utc() + datetime.timedelta(days=1, seconds=1), sn_misc.get_today_utc() + datetime.timedelta(days=1, hours=23, minutes=59, seconds=59)), (sn_misc.get_today_utc() + datetime.timedelta(days=2, seconds=1), sn_misc.get_today_utc() + datetime.timedelta(days=2, hours=23, minutes=59, seconds=59)) ] self.assertCountEqual(a_slots, x_slots) p_slots_applicable_objs = pass_models.PassSlots.objects.filter( groundstation__identifier=self.__gs_1_id, spacecraft__identifier=self.__sc_1_id, start__gte=sn_misc.get_now_utc()) p_slots_applicable = p_slots_applicable_objs.values_list( 'start', 'end') self.assertGreaterEqual(len(p_slots_2), len(p_slots_applicable)) o_slots_1 = operational_models.OperationalSlot.objects.filter( pass_slot__in=p_slots_applicable_objs, state=operational_models.STATE_FREE).values_list('start', 'end') self.assertCountEqual(p_slots_applicable, o_slots_1) # CHECK E: RPC interface should return an equivalent set of slots: o_slots_gs = gs_ops_rpc.get_operational_slots(self.__gs_1_id) self.assertEqual(len(o_slots_gs[self.__sc_1_id]), len(o_slots_1)) if self.__verbose_testing: sn_misc.print_list(o_slots_1, name='o_slots_1') sn_misc.print_list(o_slots_gs[self.__sc_1_id], name='o_slots-' + self.__gs_1_id)