Exemplo n.º 1
0
    def test_get_reservation_status(self):
        port = 15128
        self.configurationManager._set_value(self.rfs.FACADE_JSON_PORT, port)
        self.rfs.start()
        try:
            client = WebLabDeustoClient("http://localhost:%s/weblab/" % port)

            expected_sess_id = SessionId.SessionId("whatever")
            NUMBER   = 5

            expected_confirmed_reservation = Reservation.ConfirmedReservation("reservation_id", NUMBER, "{}", 'http://www.weblab.deusto.es/...', '')
            self.mock_server.return_values['get_reservation_status'] = expected_confirmed_reservation

            confirmed_reservation = client.get_reservation_status(expected_sess_id)

            self.assertEquals(
                    expected_sess_id.id,
                    self.mock_server.arguments['get_reservation_status'][0]
                )
            self.assertEquals(
                    expected_confirmed_reservation.time,    
                    confirmed_reservation.time
                )
            self.assertEquals(
                    expected_confirmed_reservation.status,
                    confirmed_reservation.status
                )
        finally:
            self.rfs.stop()
Exemplo n.º 2
0
        def test_get_reservation_status(self):
            self.configurationManager._set_value(self.rfs.FACADE_ZSI_PORT, 14128)
            self.rfs.start()
            try:
                wds = UserProcessingWebLabDeustoSOAP("http://localhost:14128/weblab/soap/")

                expected_sess_id = SessionId.SessionId("whatever")
                NUMBER   = 5

                expected_confirmed_reservation = Reservation.ConfirmedReservation("reservation_id", NUMBER, "{}", 'http://www.weblab.deusto.es/...', '')
                self.mock_server.return_values['get_reservation_status'] = expected_confirmed_reservation

                confirmed_reservation = wds.get_reservation_status(expected_sess_id)

                self.assertEquals(
                        expected_sess_id.id,
                        self.mock_server.arguments['get_reservation_status'][0]
                    )
                self.assertEquals(
                        expected_confirmed_reservation.time,    
                        confirmed_reservation.time
                    )
                self.assertEquals(
                        expected_confirmed_reservation.status,
                        confirmed_reservation.status
                    )
            finally:
                self.rfs.stop()
    def test_return_reserve_experiment(self):
        expected_sess_id = SessionId.SessionId("whatever")
        experimentA, _ = _generate_two_experiments()
        expected_reservation = Reservation.ConfirmedReservation(
            "reservation_id", 100, "{}", 'http://www.weblab.deusto.es/...', '')

        self.mock_ups.return_values[
            'reserve_experiment'] = expected_reservation

        self.assertEquals(
            expected_reservation,
            self.rfm.reserve_experiment(expected_sess_id,
                                        experimentA.to_experiment_id(), "{}",
                                        "{}"))

        self.assertEquals(expected_sess_id.id,
                          self.mock_ups.arguments['reserve_experiment'][0].id)
        self.assertEquals(
            experimentA.name,
            self.mock_ups.arguments['reserve_experiment'][1].exp_name)
        self.assertEquals(
            experimentA.category.name,
            self.mock_ups.arguments['reserve_experiment'][1].cat_name)
        self.assertEquals("{}",
                          self.mock_ups.arguments['reserve_experiment'][2])
    def test_return_get_reservation_status(self):
        expected_sess_id = {'id': "whatever"}

        expected_reservation = Reservation.ConfirmedReservation(
            "reservation_id", 100, "{}", 'http://www.weblab.deusto.es/...', '')

        self.mock_ups.return_values[
            'get_reservation_status'] = expected_reservation

        reservation = self.rfm.get_reservation_status(expected_sess_id)

        self.assertEquals(
            expected_sess_id['id'],
            self.mock_ups.arguments['get_reservation_status'][0].id)
        self.assertEquals(expected_reservation.status, reservation.status)
        self.assertEquals(expected_reservation.time, reservation.time)
Exemplo n.º 5
0
    def test_reserve_experiment(self):
        port = 15126
        self.configurationManager._set_value(self.rfs.FACADE_JSON_PORT, port)
        self.rfs.start()
        try:
            client = WebLabDeustoClient("http://127.0.0.1:%s/weblab/" % port)

            expected_sess_id = SessionId.SessionId("whatever")
            NUMBER   = 5

            expected_confirmed_reservation = Reservation.ConfirmedReservation("reservation_id", NUMBER, "{}", 'http://www.weblab.deusto.es/...', '')
            expected_experiment_id = self._generate_two_experiments()[0].to_experiment_id()

            self._generate_experiments_allowed()
            self.mock_server.return_values['reserve_experiment'] = expected_confirmed_reservation

            confirmed_reservation = client.reserve_experiment(expected_sess_id, expected_experiment_id, "{}", "{}")

            self.assertEquals(
                    expected_sess_id.id,
                    self.mock_server.arguments['reserve_experiment'][0]
                )
            self.assertEquals(
                    expected_experiment_id.exp_name,
                    self.mock_server.arguments['reserve_experiment'][1].exp_name
                )
            self.assertEquals(
                    expected_experiment_id.cat_name,
                    self.mock_server.arguments['reserve_experiment'][1].cat_name
                )
            self.assertEquals(
                    expected_confirmed_reservation.time,    
                    confirmed_reservation.time
                )
            self.assertEquals(
                    expected_confirmed_reservation.status,
                    confirmed_reservation.status
                )
        finally:
            self.rfs.stop()
Exemplo n.º 6
0
        def test_reserve_experiment(self):
            self.configurationManager._set_value(self.rfs.FACADE_ZSI_PORT, 14126)
            self.rfs.start()
            try:
                wds = UserProcessingWebLabDeustoSOAP("http://localhost:14126/weblab/soap/")

                expected_sess_id = SessionId.SessionId("whatever")
                NUMBER   = 5

                expected_confirmed_reservation = Reservation.ConfirmedReservation("reservation_id", NUMBER, "{}", 'http://www.weblab.deusto.es/...', '')
                expected_experiment_id = self._generate_two_experiments()[0].to_experiment_id()

                self._generate_experiments_allowed()
                self.mock_server.return_values['reserve_experiment'] = expected_confirmed_reservation

                confirmed_reservation = wds.reserve_experiment(expected_sess_id, expected_experiment_id, "{}", "{}")

                self.assertEquals(
                        expected_sess_id.id,
                        self.mock_server.arguments['reserve_experiment'][0]
                    )
                self.assertEquals(
                        expected_experiment_id.exp_name,
                        self.mock_server.arguments['reserve_experiment'][1].exp_name
                    )
                self.assertEquals(
                        expected_experiment_id.cat_name,
                        self.mock_server.arguments['reserve_experiment'][1].cat_name
                    )
                self.assertEquals(
                        expected_confirmed_reservation.time,    
                        confirmed_reservation.time
                    )
                self.assertEquals(
                        expected_confirmed_reservation.status,
                        confirmed_reservation.status
                    )
            finally:
                self.rfs.stop()