def setUp(self): self.__verbose_testing = False self.__sc_id = 'humsat-d' self.__ufo_id = 'object-111' self.__user_1 = db_tools.create_user_profile() self.__user_2 = db_tools.create_user_profile(username='******') self.__request_1 = db_tools.create_request(user_profile=self.__user_1) self.__request_2 = db_tools.create_request(user_profile=self.__user_2) self.__sc = db_tools.create_sc(user_profile=self.__user_1, identifier=self.__sc_id) self.__ufo = db_tools.create_sc(user_profile=self.__user_2, identifier=self.__ufo_id, is_ufo=True) self.__admin = db_tools.create_user_profile(username='******', email='*****@*****.**', is_staff=True) self.__request_3 = db_tools.create_request(user_profile=self.__admin) self.__cluster = db_tools.create_launch(admin=self.__admin) if not self.__verbose_testing: logging.getLogger('leop').setLevel(level=logging.CRITICAL)
def setUp(self): self.__verbose_testing = False self.__sc_id = 'humsat-d' self.__ufo_id = 'object-111' self.__user_1 = db_tools.create_user_profile() self.__user_2 = db_tools.create_user_profile(username='******') self.__request_1 = db_tools.create_request(user_profile=self.__user_1) self.__request_2 = db_tools.create_request(user_profile=self.__user_2) self.__sc = db_tools.create_sc( user_profile=self.__user_1, identifier=self.__sc_id ) self.__ufo = db_tools.create_sc( user_profile=self.__user_2, identifier=self.__ufo_id, is_ufo=True ) self.__admin = db_tools.create_user_profile( username='******', email='*****@*****.**', is_staff=True ) self.__request_3 = db_tools.create_request(user_profile=self.__admin) self.__cluster = db_tools.create_launch(admin=self.__admin) if not self.__verbose_testing: logging.getLogger('leop').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): """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): """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): """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_sc_id = 'sc-canx-2' self.__sc_id = 'humd-sc' self.__user_profile = db_tools.create_user_profile() self.__request = db_tools.create_request( user_profile=self.__user_profile) self.__sc_callsign = 'HUMXXX7' self.__sc_tle_1_id = 'HUMSAT-D' self.__sc_tle_2_id = 'CANX-2' self.__gs_id = 'my-gs' self.__gs_callsign = 'GSXXGX' self.__gs_elevation = 20.1 self.__gs_latitude = 54.80 self.__gs_longitude = -8.90 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) logging.getLogger('simulation').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 self.__test_sc_id = 'sc-canx-2' self.__sc_id = 'humd-sc' self.__user_profile = db_tools.create_user_profile() self.__request = db_tools.create_request( user_profile=self.__user_profile ) self.__sc_callsign = 'HUMXXX7' self.__sc_tle_1_id = 'HUMSAT-D' self.__sc_tle_2_id = 'CANX-2' self.__gs_id = 'my-gs' self.__gs_callsign = 'GSXXGX' self.__gs_elevation = 20.1 self.__gs_latitude = 54.80 self.__gs_longitude = -8.90 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) logging.getLogger('simulation').setLevel(level=logging.CRITICAL)
def test_get_user(self): """UNIT test: services.accounts.utils - user from HTTP request Should extract the user object and username from a HTTP request """ username = '******' user_profile = db_tools.create_user_profile( username=username ) http_request = db_tools.create_request(user_profile=user_profile) username_2 = 'another' user_profile_2 = db_tools.create_user_profile( username=username_2 ) self.assertEqual( account_models.get_user( http_request=http_request, permissions_flag=False, test_username=username, testing_flag=False ), (user_profile, username), 'Error extracing the user data from HTTP request' ) self.assertEqual( account_models.get_user( http_request=http_request, permissions_flag=False, test_username=username_2, testing_flag=False ), (user_profile_2, username_2), 'Error extracting the user data when no HTTP request is given' )
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): """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): """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 test_sc_list_mine(self): """JRPC test: configuration.sc.list.mine This test validates the list of SpacecraftConfiguration objects returned through the JRPC method. """ if self.__verbose_testing: print('>>> TEST (test_sc_list_mine)') self.assertEquals( jrpc_sc.list_spacecraft_mine(request=self.__http_request), [ self.__sc_1_id, self.__sc_2_id ] ) user_profile_2 = db_tools.create_user_profile( username='******' ) request_2 = db_tools.create_request(user_profile=user_profile_2) self.assertListEqual( jrpc_sc.list_spacecraft_mine(request=request_2), [] )
def test_gs_list_others(self): """JRPC test: configuration.gs.list.others This test validates the list of GroundStation objects returned through the JRPC method. """ if self.__verbose_testing: print('>>> TEST (test_sc_list_others)') self.assertListEqual( jrpc_gs.list_groundstations_others(request=self.__http_request), [] ) user_profile_2 = db_tools.create_user_profile( username='******' ) request_2 = db_tools.create_request(user_profile=user_profile_2) self.assertListEqual( jrpc_gs.list_groundstations_others(request=request_2), [ self.__gs_1_id, self.__gs_2_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): """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): """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): """Test setup. No database setup is necessary for this test. """ self.__verbose_testing = False self.__http_request = db_tools.create_request()