def test_reserve_experiment_with_priority(self):

        #
        # Two normal users come in and get their experiments
        #
        status, reservation1_id = self.coordinator.reserve_experiment(ExperimentId("exp1","cat1"), DEFAULT_TIME, DEFAULT_PRIORITY, True, DEFAULT_INITIAL_DATA, DEFAULT_REQUEST_INFO, DEFAULT_CONSUMER_DATA)
        expected_status = WSS.WaitingConfirmationQueueStatus(reservation1_id, DEFAULT_URL)
        self.assertEquals( expected_status, status )

        status, reservation2_id = self.coordinator.reserve_experiment(ExperimentId("exp1","cat1"), DEFAULT_TIME, DEFAULT_PRIORITY, True, DEFAULT_INITIAL_DATA, DEFAULT_REQUEST_INFO, DEFAULT_CONSUMER_DATA)
        expected_status = WSS.WaitingConfirmationQueueStatus(reservation2_id, DEFAULT_URL)
        self.assertEquals( expected_status, status )

        #
        # Now, one user with a priority of 4 and then another comes with a priority of 3. We check that the second user
        # gets the first position
        #
        status, reservation3_id = self.coordinator.reserve_experiment(ExperimentId("exp1","cat1"), DEFAULT_TIME, 4, True, DEFAULT_INITIAL_DATA, DEFAULT_REQUEST_INFO, DEFAULT_CONSUMER_DATA)
        expected_status = WSS.WaitingQueueStatus(reservation3_id, 0) # In the very first moment
        self.assertEquals( expected_status, status )

        status, reservation4_id = self.coordinator.reserve_experiment(ExperimentId("exp1","cat1"), DEFAULT_TIME, 3, True, DEFAULT_INITIAL_DATA, DEFAULT_REQUEST_INFO, DEFAULT_CONSUMER_DATA)
        expected_status = WSS.WaitingQueueStatus(reservation4_id, 0) # Now he's the first
        self.assertEquals( expected_status, status )

        status = self.coordinator.get_reservation_status(reservation3_id)
        expected_status = WSS.WaitingQueueStatus(reservation3_id, 1)
        self.assertEquals( expected_status, status )

        #
        # Check that if a fifth user comes with priority 3, he will be after the number 4,
        # but still before number 3
        #
        status, reservation5_id = self.coordinator.reserve_experiment(ExperimentId("exp1","cat1"), DEFAULT_TIME, 3, True, DEFAULT_INITIAL_DATA, DEFAULT_REQUEST_INFO, DEFAULT_CONSUMER_DATA)
        expected_status = WSS.WaitingQueueStatus(reservation5_id, 1)
        self.assertEquals( expected_status, status )
Send DDL to create the specified `table` triggers
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/test/unit/weblab/core/coordinator/test_coordinator.py/AbstractCoordinatorTestCase.test_reserve_experiment_with_priority--crossover with--dataset/ETHPy150Open philipsoutham/py-mysql2pgsql/mysql2pgsql/lib/postgres_db_writer.py/PostgresDbWriter.write_triggers