|
|
|
@ -154,9 +154,6 @@ def test_bookings_api(app, user):
|
|
|
|
|
'user_last_name': '',
|
|
|
|
|
'user_email': '',
|
|
|
|
|
'user_phone_number': '',
|
|
|
|
|
'user_was_present': None,
|
|
|
|
|
'user_absence_reason': None,
|
|
|
|
|
'user_presence_reason': None,
|
|
|
|
|
'use_color_for': None,
|
|
|
|
|
'extra_data': None,
|
|
|
|
|
'cancellation_datetime': None,
|
|
|
|
@ -630,6 +627,12 @@ def test_booking_patch_api_present(app, user, flag):
|
|
|
|
|
resp = app.patch_json('/api/booking/%s/' % booking.pk)
|
|
|
|
|
assert resp.json['err'] == 0
|
|
|
|
|
|
|
|
|
|
agenda.kind = 'meetings'
|
|
|
|
|
agenda.save()
|
|
|
|
|
resp = app.patch_json('/api/booking/%s/' % booking.pk, params={'user_was_present': flag}, status=400)
|
|
|
|
|
assert resp.json['err'] == 7
|
|
|
|
|
assert resp.json['err_desc'] == 'can not set check fields for non events agenda'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mock.patch('chrono.api.serializers.get_agenda_check_types')
|
|
|
|
|
def test_booking_patch_api_absence_reason(check_types, app, user):
|
|
|
|
@ -739,6 +742,14 @@ def test_booking_patch_api_absence_reason(check_types, app, user):
|
|
|
|
|
resp = app.patch_json('/api/booking/%s/' % booking.pk)
|
|
|
|
|
assert resp.json['err'] == 0
|
|
|
|
|
|
|
|
|
|
agenda.kind = 'meetings'
|
|
|
|
|
agenda.save()
|
|
|
|
|
resp = app.patch_json(
|
|
|
|
|
'/api/booking/%s/' % booking.pk, params={'user_absence_reason': 'foo-bar'}, status=400
|
|
|
|
|
)
|
|
|
|
|
assert resp.json['err'] == 7
|
|
|
|
|
assert resp.json['err_desc'] == 'can not set check fields for non events agenda'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mock.patch('chrono.api.serializers.get_agenda_check_types')
|
|
|
|
|
def test_booking_patch_api_presence_reason(check_types, app, user):
|
|
|
|
@ -848,6 +859,14 @@ def test_booking_patch_api_presence_reason(check_types, app, user):
|
|
|
|
|
resp = app.patch_json('/api/booking/%s/' % booking.pk)
|
|
|
|
|
assert resp.json['err'] == 0
|
|
|
|
|
|
|
|
|
|
agenda.kind = 'meetings'
|
|
|
|
|
agenda.save()
|
|
|
|
|
resp = app.patch_json(
|
|
|
|
|
'/api/booking/%s/' % booking.pk, params={'user_presence_reason': 'foo-bar'}, status=400
|
|
|
|
|
)
|
|
|
|
|
assert resp.json['err'] == 7
|
|
|
|
|
assert resp.json['err_desc'] == 'can not set check fields for non events agenda'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_booking_patch_api_both_reasons(app, user):
|
|
|
|
|
agenda = Agenda.objects.create(kind='events')
|
|
|
|
|