mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 13:49:17 +02:00
Update request status based on batch status
This commit is contained in:
parent
b492e133c6
commit
f3d77ef7d9
3 changed files with 66 additions and 0 deletions
23
api/tests/requests/test_models.py
Normal file
23
api/tests/requests/test_models.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import pytest
|
||||
|
||||
from django.forms import ValidationError
|
||||
|
||||
|
||||
def test_can_bind_import_batch_to_request(factories):
|
||||
request = factories['requests.ImportRequest']()
|
||||
|
||||
assert request.status == 'pending'
|
||||
|
||||
# when we create the import, we consider the request as accepted
|
||||
batch = factories['music.ImportBatch'](import_request=request)
|
||||
request.refresh_from_db()
|
||||
|
||||
assert request.status == 'accepted'
|
||||
|
||||
# now, the batch is finished, therefore the request status should be
|
||||
# imported
|
||||
batch.status = 'finished'
|
||||
batch.save(update_fields=['status'])
|
||||
request.refresh_from_db()
|
||||
|
||||
assert request.status == 'imported'
|
Loading…
Add table
Add a link
Reference in a new issue