#NEWLINE# def _sc_get_operational_slots( self ) : #NEWLINE# #INDENT# '\n        Validates the JRPC method <sc_get_operational_slots>\n        ' #NEWLINE# if self . __verbose_testing : #NEWLINE# #INDENT# print ( '##### test_sc_get_operational_slots' ) #NEWLINE# #UNINDENT# operational_models . OperationalSlot . objects . reset_ids_counter ( ) #NEWLINE# self . assertRaises ( models . ObjectDoesNotExist , jrpc_sc_scheduling . get_operational_slots , 0 ) #NEWLINE# 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!' ) #NEWLINE# self . assertRaises ( Exception , jrpc_sc_scheduling . get_operational_slots , self . __sc_1_ch_1_id ) #NEWLINE# 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!' ) #NEWLINE# date_i = ( misc . get_today_utc ( ) + datetime . timedelta ( days = 1 ) ) #NEWLINE# date_f = ( misc . get_today_utc ( ) + datetime . timedelta ( days = 366 ) ) #NEWLINE# now = misc . get_now_utc ( ) #NEWLINE# s_time = ( now + datetime . timedelta ( minutes = 30 ) ) #NEWLINE# e_time = ( now + datetime . timedelta ( minutes = 45 ) ) #NEWLINE# jrpc_rules . add_rule ( self . __gs_1_id , self . __gs_1_ch_1_id , db_tools . create_jrpc_daily_rule ( date_i = date_i , date_f = date_f , starting_time = s_time , ending_time = e_time ) ) #NEWLINE# actual = jrpc_sc_scheduling . get_operational_slots ( self . __sc_1_id ) #NEWLINE# expected = { #NEWLINE# #INDENT# self . __sc_1_ch_1_id : { #NEWLINE# #INDENT# self . __gs_1_ch_1_id : { #NEWLINE# #INDENT# segment_serializers . GS_ID_K : self . __sc_1_id , #NEWLINE# jrpc_sch_serial . SLOTS_K : [ { #NEWLINE# #INDENT# jrpc_sch_serial . SLOT_IDENTIFIER_K : '1' , #NEWLINE# jrpc_sch_serial . STATE_K : operational_models . STATE_FREE , #NEWLINE# jrpc_sch_serial . DATE_START_K : ( s_time + datetime . timedelta ( days = 1 ) ) . isoformat ( ) , #NEWLINE# jrpc_sch_serial . DATE_END_K : ( e_time + datetime . timedelta ( days = 1 ) ) . isoformat ( ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# jrpc_sch_serial . SLOT_IDENTIFIER_K : '2' , #NEWLINE# jrpc_sch_serial . STATE_K : operational_models . STATE_FREE , #NEWLINE# jrpc_sch_serial . DATE_START_K : ( s_time + datetime . timedelta ( days = 2 ) ) . isoformat ( ) , #NEWLINE# jrpc_sch_serial . DATE_END_K : ( e_time + datetime . timedelta ( days = 2 ) ) . isoformat ( ) , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( actual , expected , 'Expected different slots!' ) #NEWLINE# self . assertTrue ( jrpc_gs_chs . gs_channel_delete ( groundstation_id = self . __gs_1_id , channel_id = self . __gs_1_ch_1_id ) , ( 'Could not delete GroundStationChannel = ' + str ( self . __gs_1_ch_1_id ) ) ) #NEWLINE# self . assertTrue ( jrpc_sc_chs . sc_channel_delete ( spacecraft_id = self . __sc_1_id , channel_id = self . __sc_1_ch_1_id ) , ( 'Could not delete SpacecraftChannel = ' + str ( self . __sc_1_ch_1_id ) ) )