def test_update_future_reservation_start(tables, client, future_reservation,
                                         permissive_restriction):
    permissive_restriction.save()
    future_reservation.save()

    new_reservation_start = future_reservation.start + timedelta(hours=1)
    resp = client.put(
        ENDPOINT + '/' + str(future_reservation.id),
        headers=HEADERS,
        data=json.dumps({
            'start':
            DateUtils.stringify_datetime_to_api_format(new_reservation_start)
        }))
    resp_json = json.loads(resp.data.decode('utf-8'))

    assert resp.status_code == HTTPStatus.CREATED
    assert resp_json['reservation']['start'] == DateUtils.stringify_datetime(
        new_reservation_start)
    assert Reservation.get(
        future_reservation.id).start == new_reservation_start
Beispiel #2
0
 def _serialize(self, field):
     if type(field) == datetime.datetime:
         return DateUtils.stringify_datetime(field)
     else:
         return field