"""FC-2d-iii: import_file maps 'attached' + enqueues ML for members."""

import pytest

from backend.app.services.importer import ImportResult
from backend.app.tasks.import_file import _map_result_to_status

pytestmark = pytest.mark.integration  # imports the celery app graph


def test_attached_maps_to_complete_no_requeue():
    status, requeue = _map_result_to_status(
        ImportResult(status="attached")
    )
    assert status == "complete"
    assert requeue is False


def test_imported_still_requeues():
    status, requeue = _map_result_to_status(
        ImportResult(status="imported", image_id=5)
    )
    assert status == "complete"
    assert requeue is True
