Skip to content
Snippets Groups Projects
test_models.py 653 B
Newer Older
  • Learn to ignore specific revisions
  • import pytest
    
    
    @pytest.mark.skip(reason="Refactoring in progress")
    
    def test_can_bind_import_batch_to_request(factories):
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        request = factories["requests.ImportRequest"]()
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        assert request.status == "pending"
    
    
        # when we create the import, we consider the request as accepted
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        batch = factories["music.ImportBatch"](import_request=request)
    
        request.refresh_from_db()
    
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        assert request.status == "accepted"
    
    
        # now, the batch is finished, therefore the request status should be
        # imported
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        batch.status = "finished"
        batch.save(update_fields=["status"])
    
        request.refresh_from_db()
    
    
    Eliot Berriot's avatar
    Eliot Berriot committed
        assert request.status == "imported"