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)
Example #2
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)
 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)
Example #4
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)
Example #5
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)
Example #6
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)
Example #7
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)
Example #8
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)
 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)
 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)