Order API: Add magic value to keep current file

This commit is contained in:
Raphael Michel
2021-04-16 15:26:49 +02:00
parent 16cd6598b3
commit 294cb65388
3 changed files with 28 additions and 1 deletions

View File

@@ -4951,6 +4951,7 @@ def test_position_update_question_handling(token_client, organizer, event, order
)
assert r.status_code == 201
file_id_png = r.data['id']
payload = {
'answers': [
{
@@ -4971,3 +4972,24 @@ def test_position_update_question_handling(token_client, organizer, event, order
answ = op.answers.get()
assert answ.file
assert answ.answer.startswith("file://")
payload = {
'answers': [
{
"question": question.id,
"answer": "file:keep"
}
]
}
question.type = Question.TYPE_FILE
question.save()
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
answ = op.answers.get()
assert answ.file
assert answ.answer.startswith("file://")