def test_gs_get_operational_slots(self):
        """JRPC test: services.scheduling.gs.getOperationalSlots
        Validates the JRPC method <gs_get_operational_slots>
        """
        if self.__verbose_testing:
            print('##### test_gs_get_operational_slots')
            self.maxDiff = None

        operational_models.OperationalSlot.objects.reset_ids_counter()

        if self.__verbose_testing:
            print('######### CHECK #1')
            misc.print_list(
                availability_models.AvailabilitySlot.objects.all(),
                name='availability'
            )
            misc.print_list(
                compatibility_models.ChannelCompatibility.objects.all(),
                name='compatibility'
            )
            misc.print_list(
                pass_models.PassSlots.objects.all(),
                name='passes'
            )
            misc.print_list(
                operational_models.OperationalSlot.objects.all(),
                name='operational'
            )

        # 1) non-existant GroundStation
        self.assertRaises(
            models.ObjectDoesNotExist,
            jrpc_gs_scheduling.get_operational_slots,
            0
        )

        # 2) basic test, should not generate slots until the GS is added,
        # raising an exception to confirm it
        self.assertTrue(
            jrpc_gs_ch_if.gs_channel_create(
                groundstation_id=self.__gs_1_id,
                channel_id=self.__gs_1_ch_1_id,
                configuration=self.__gs_1_ch_1_cfg
            ),
            '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.assertTrue(
            jrpc_sc_ch_if.sc_channel_create(
                spacecraft_id=self.__sc_1_id,
                channel_id=self.__sc_1_ch_1_id,
                configuration=self.__sc_1_ch_1_cfg
            ),
            'Channel should have been created!'
        )

        date_i = misc.get_today_utc() + datetime.timedelta(days=1)
        date_f = misc.get_today_utc() + datetime.timedelta(days=366)

        s_time = datetime.timedelta(hours=20) - misc.get_next_midnight()
        e_time = s_time + datetime.timedelta(hours=12)

        jrpc_rules.add_rule(
            self.__gs_1_id,
            db_tools.create_jrpc_daily_rule(
                date_i=date_i,
                date_f=date_f,
                starting_time=s_time,
                ending_time=e_time
            )
        )

        if self.__verbose_testing:
            print('######### CHECK #2')
            misc.print_list(
                availability_models.AvailabilitySlot.objects.all(),
                name='availability'
            )
            misc.print_list(
                compatibility_models.ChannelCompatibility.objects.all(),
                name='compatibility'
            )
            misc.print_list(
                pass_models.PassSlots.objects.all(),
                name='passes'
            )
            misc.print_list(
                operational_models.OperationalSlot.objects.all(),
                name='operational'
            )

        self.assertGreater(
            len(jrpc_gs_scheduling.get_operational_slots(self.__gs_1_id)), 0
        )

        # ### clean up sc/gs
        self.assertTrue(
            jrpc_gs_ch_if.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
            )
        )

        self.assertEquals(
            len(jrpc_gs_scheduling.get_operational_slots(self.__gs_1_id)), 0
        )

        self.assertTrue(
            jrpc_sc_ch_if.sc_channel_delete(
                spacecraft_id=self.__sc_1_id, channel_id=self.__sc_1_ch_1_id
            )
        )

        self.assertEquals(
            len(jrpc_gs_scheduling.get_operational_slots(self.__gs_1_id)), 0
        )
dataset/ETHPy150Open satnet-project/server/services/scheduling/tests/jrpc/test_groundstations.py/JRPCGroundStationsSchedulingTest.test_gs_get_operational_slots/swapped operands of `-`