import pytest

from keble_helpers.typings import (
    CloudStorageBase,
    CloudStorageObjectType,
    CloudStorageType,
)


@pytest.mark.parametrize(
    "mime, expected",
    [
        ("video/mp4", CloudStorageObjectType.VIDEO),
        ("image/png", CloudStorageObjectType.IMAGE),
        (
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            CloudStorageObjectType.EXCEL,
        ),
        ("text/csv", CloudStorageObjectType.CSV),
        ("application/pdf", CloudStorageObjectType.OTHER),
        ("IMAGE/PNG", CloudStorageObjectType.IMAGE),
    ],
)
def test_cloud_storage_object_type_determine_type(mime, expected):
    assert CloudStorageObjectType.determine_type(mime=mime) == expected


def test_cloud_storage_base_smoke():
    storage = CloudStorageBase(
        key="example.png",
        base_url="https://example.com/",
        type=CloudStorageType.AWS_S3,
        object_type=CloudStorageObjectType.IMAGE,
        original_file_name="example.png",
    )
    assert storage.key == "example.png"
