def test_translate_reservation_waiting(self):
     status = WSS.WaitingQueueStatus('foo', 5)
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.WAITING, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals(5, reservation.position)
     self.assertEquals(status, reservation.to_status())
 def test_translate_reservation_from_data_post_reservation(self):
     reservation = Reservation.translate_reservation_from_data(Reservation.POST_RESERVATION, 'foo', None, None, None, "{}", None, True, "{ }", None)
     self.assertEquals(Reservation.POST_RESERVATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('{ }', reservation.initial_data)
     self.assertEquals('{}', reservation.end_data)
     self.assertTrue(reservation.finished)
Esempio n. 3
0
 def test_translate_reservation_waiting_confirmation(self):
     status = WSS.WaitingConfirmationQueueStatus('foo', 'http://...')
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.WAITING_CONFIRMATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
     self.assertEquals(status, reservation.to_status())
 def test_translate_reservation_waiting_confirmation(self):
     status = WSS.WaitingConfirmationQueueStatus('foo', 'http://...')
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.WAITING_CONFIRMATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
     self.assertEquals(status, reservation.to_status())
Esempio n. 5
0
 def test_translate_reservation_from_data_waiting_instances(self):
     reservation = Reservation.translate_reservation_from_data(
         Reservation.WAITING_INSTANCES, 'foo', 5, None, None, None, None,
         None, None, None)
     self.assertEquals(Reservation.WAITING_INSTANCES, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals(5, reservation.position)
Esempio n. 6
0
 def test_translate_reservation_waiting(self):
     status = WSS.WaitingQueueStatus('foo', 5)
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.WAITING, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals(5, reservation.position)
     self.assertEquals(status, reservation.to_status())
Esempio n. 7
0
 def test_translate_reservation_from_data_waiting_confirmation(self):
     reservation = Reservation.translate_reservation_from_data(
         Reservation.WAITING_CONFIRMATION, 'foo', None, None, None, None,
         'http://...', None, None, None)
     self.assertEquals(Reservation.WAITING_CONFIRMATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
 def test_translate_reservation_from_data_confirmed_remote(self):
     reservation = Reservation.translate_reservation_from_data(Reservation.CONFIRMED, 'foo', None, 80, "{}", None, 'http://...', None, None, 'bar')
     self.assertEquals(Reservation.CONFIRMED, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
     self.assertEquals('{}', reservation.initial_configuration)
     self.assertEquals('bar', reservation.remote_reservation_id.id)
Esempio n. 9
0
    def _parse_reservation_holder(self, reservation_holder):
        if reservation_holder.get('remote_reservation_id') is None:
            remote_reservation_id = None
        else:
            remote_reservation_id = reservation_holder['remote_reservation_id'].get('id')

        return Reservation.translate_reservation_from_data(reservation_holder['status'], reservation_holder['reservation_id']['id'], reservation_holder.get('position'), reservation_holder.get('time'), reservation_holder.get('initial_configuration'), reservation_holder.get('end_data'), reservation_holder.get('url'), reservation_holder.get('finished'), reservation_holder.get('initial_data'), remote_reservation_id)
Esempio n. 10
0
 def test_translate_reservation_from_data_confirmed(self):
     reservation = Reservation.translate_reservation_from_data(
         Reservation.CONFIRMED, 'foo', None, 80, "{}", None, 'http://...',
         None, None, '')
     self.assertEquals(Reservation.CONFIRMED, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
     self.assertEquals('{}', reservation.initial_configuration)
Esempio n. 11
0
 def test_translate_reservation_post_reservation(self):
     status = WSS.PostReservationStatus('foo', True, "{ }", "{}")
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.POST_RESERVATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('{ }', reservation.initial_data)
     self.assertEquals('{}', reservation.end_data)
     self.assertTrue(reservation.finished)
     self.assertEquals(status, reservation.to_status())
Esempio n. 12
0
 def test_translate_reservation_post_reservation(self):
     status = WSS.PostReservationStatus('foo', True, "{ }", "{}")
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.POST_RESERVATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('{ }', reservation.initial_data)
     self.assertEquals('{}', reservation.end_data)
     self.assertTrue(reservation.finished)
     self.assertEquals(status, reservation.to_status())
Esempio n. 13
0
 def test_translate_reservation_from_data_post_reservation(self):
     reservation = Reservation.translate_reservation_from_data(
         Reservation.POST_RESERVATION, 'foo', None, None, None, "{}", None,
         True, "{ }", None)
     self.assertEquals(Reservation.POST_RESERVATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('{ }', reservation.initial_data)
     self.assertEquals('{}', reservation.end_data)
     self.assertTrue(reservation.finished)
Esempio n. 14
0
 def test_translate_remote_reservation_reserved(self):
     status = WSS.RemoteReservedStatus('foo', 100, "{}",'http://...', "bar")
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.CONFIRMED, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
     self.assertEquals('{}', reservation.initial_configuration)
     self.assertEquals('bar', reservation.remote_reservation_id.id)
     self.assertEquals(status, reservation.to_status())
Esempio n. 15
0
    def test_translate_local_reservation_reserved(self):
        status = WSS.LocalReservedStatus('foo', 'i:s@m', 'lab_session', 100, "{}", time.time(), time.time(), True, 80, 'http://...')
        reservation = Reservation.translate_reservation(status)
        self.assertEquals(Reservation.CONFIRMED, reservation.status)
        self.assertEquals('foo', reservation.reservation_id.id)
        self.assertEquals('http://...', reservation.url)
        self.assertEquals('{}', reservation.initial_configuration)

        status = WSS.RemoteReservedStatus('foo', 80, '{}', 'http://...','')
        self.assertEquals(status, reservation.to_status())
Esempio n. 16
0
 def test_translate_remote_reservation_reserved(self):
     status = WSS.RemoteReservedStatus('foo', 100, "{}", 'http://...',
                                       "bar")
     reservation = Reservation.translate_reservation(status)
     self.assertEquals(Reservation.CONFIRMED, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
     self.assertEquals('{}', reservation.initial_configuration)
     self.assertEquals('bar', reservation.remote_reservation_id.id)
     self.assertEquals(status, reservation.to_status())
Esempio n. 17
0
    def test_translate_local_reservation_reserved(self):
        status = WSS.LocalReservedStatus('foo', 'i:s@m',
                                         'lab_session', 100, "{}", time.time(),
                                         time.time(), True, 80, 'http://...')
        reservation = Reservation.translate_reservation(status)
        self.assertEquals(Reservation.CONFIRMED, reservation.status)
        self.assertEquals('foo', reservation.reservation_id.id)
        self.assertEquals('http://...', reservation.url)
        self.assertEquals('{}', reservation.initial_configuration)

        status = WSS.RemoteReservedStatus('foo', 80, '{}', 'http://...', '')
        self.assertEquals(status, reservation.to_status())
Esempio n. 18
0
    def _parse_reservation_holder(self, reservation_holder):
        if reservation_holder.get('remote_reservation_id') is None:
            remote_reservation_id = None
        else:
            remote_reservation_id = reservation_holder[
                'remote_reservation_id'].get('id')

        return Reservation.translate_reservation_from_data(
            reservation_holder['status'],
            reservation_holder['reservation_id']['id'],
            reservation_holder.get('position'), reservation_holder.get('time'),
            reservation_holder.get('initial_configuration'),
            reservation_holder.get('end_data'), reservation_holder.get('url'),
            reservation_holder.get('finished'),
            reservation_holder.get('initial_data'), remote_reservation_id)
Esempio n. 19
0
 def test_translate_reservation_from_data_waiting_confirmation(self):
     reservation = Reservation.translate_reservation_from_data(Reservation.WAITING_CONFIRMATION, 'foo', None, None, None, None, 'http://...', None, None, None)
     self.assertEquals(Reservation.WAITING_CONFIRMATION, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals('http://...', reservation.url)
Esempio n. 20
0
 def test_translate_reservation_from_data_waiting_instances(self):
     reservation = Reservation.translate_reservation_from_data(Reservation.WAITING_INSTANCES, 'foo', 5, None, None, None, None, None, None, None)
     self.assertEquals(Reservation.WAITING_INSTANCES, reservation.status)
     self.assertEquals('foo', reservation.reservation_id.id)
     self.assertEquals(5, reservation.position)