api: include BO label in booking serialization (#71224)
This commit is contained in:
parent
b5a29f1e76
commit
92d238d1e3
|
@ -211,6 +211,7 @@ class BookingSerializer(serializers.ModelSerializer):
|
|||
'extra_data',
|
||||
'creation_datetime',
|
||||
'cancellation_datetime',
|
||||
'label',
|
||||
]
|
||||
read_only_fields = [
|
||||
'id',
|
||||
|
|
|
@ -157,6 +157,7 @@ def test_bookings_api(app, user):
|
|||
'extra_data': None,
|
||||
'cancellation_datetime': None,
|
||||
'creation_datetime': localtime(meetings_booking1.creation_datetime).isoformat(),
|
||||
'label': '',
|
||||
},
|
||||
{
|
||||
'id': events_booking1.pk,
|
||||
|
@ -173,6 +174,7 @@ def test_bookings_api(app, user):
|
|||
'event': resp.json['data'][1]['event'],
|
||||
'cancellation_datetime': None,
|
||||
'creation_datetime': localtime(events_booking1.creation_datetime).isoformat(),
|
||||
'label': '',
|
||||
},
|
||||
{
|
||||
'id': events_booking2.pk,
|
||||
|
@ -189,6 +191,7 @@ def test_bookings_api(app, user):
|
|||
'event': resp.json['data'][1]['event'],
|
||||
'cancellation_datetime': None,
|
||||
'creation_datetime': localtime(events_booking2.creation_datetime).isoformat(),
|
||||
'label': '',
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -548,6 +551,18 @@ def test_booking_patch_api(app, user):
|
|||
assert resp.json['err'] == 4
|
||||
assert resp.json['err_desc'] == 'invalid payload'
|
||||
|
||||
resp = app.patch('/api/booking/%s/' % booking.pk, params={'label': 'foobar'})
|
||||
booking.refresh_from_db()
|
||||
assert booking.label == 'foobar'
|
||||
|
||||
resp = app.patch('/api/booking/%s/' % booking.pk, params={'label': 'the most important booking'})
|
||||
booking.refresh_from_db()
|
||||
assert booking.label == 'the most important booking'
|
||||
|
||||
resp = app.patch('/api/booking/%s/' % booking.pk, params={'label': ''})
|
||||
booking.refresh_from_db()
|
||||
assert booking.label == ''
|
||||
|
||||
|
||||
@pytest.mark.parametrize('flag', [True, False, None])
|
||||
def test_booking_patch_api_present(app, user, flag):
|
||||
|
|
|
@ -1151,6 +1151,7 @@ def test_events_check_status(app, user):
|
|||
'extra_data',
|
||||
'creation_datetime',
|
||||
'cancellation_datetime',
|
||||
'label',
|
||||
]
|
||||
assert resp.json['data'][0]['booking']['cancellation_datetime'] == localtime(now()).isoformat()
|
||||
|
||||
|
@ -1370,6 +1371,7 @@ def test_events_check_status_events(app, user):
|
|||
'user_phone_number': '',
|
||||
'user_presence_reason': 'foo-reason',
|
||||
'user_was_present': True,
|
||||
'label': '',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1408,6 +1410,7 @@ def test_events_check_status_events(app, user):
|
|||
'user_phone_number': '',
|
||||
'user_presence_reason': 'foo-reason',
|
||||
'user_was_present': True,
|
||||
'label': '',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue