diff --git a/image_handler_client/schemas/image_info.py b/image_handler_client/schemas/image_info.py index 1c2739a..3c9a47c 100644 --- a/image_handler_client/schemas/image_info.py +++ b/image_handler_client/schemas/image_info.py @@ -13,7 +13,7 @@ class ImageStatus(Enum): @dataclass(frozen=True) class ImageInfo: filename: str - date: str + date: int theme: str real: bool status: Optional[ImageStatus] = ImageStatus.UNVERIFIED @@ -21,7 +21,7 @@ class ImageInfo: class ImageInfoSchema(Schema): filename = fields.Str(required=True) - date = fields.Str(required=True) + date = fields.Int(required=True) theme = fields.Str(required=True) real = fields.Bool(required=True) status = fields.Field(required=False, load_default=ImageStatus.UNVERIFIED.value) diff --git a/tests/unit/test_image_schema.py b/tests/unit/test_image_schema.py index 85c3a70..2fe6679 100644 --- a/tests/unit/test_image_schema.py +++ b/tests/unit/test_image_schema.py @@ -6,13 +6,13 @@ def test_image_info_creation(): # Test creating an ImageInfo instance image_info = ImageInfo( filename="test_image.jpg", - date="2024-07-29", + date=1, theme="wildlife", real=True, status=ImageStatus.VERIFIED ) assert image_info.filename == "test_image.jpg" - assert image_info.date == "2024-07-29" + assert image_info.date == 1 assert image_info.theme == "wildlife" assert image_info.real is True assert image_info.status == ImageStatus.VERIFIED @@ -22,7 +22,7 @@ def test_image_info_default_status(): # Test creating an ImageInfo instance with default status image_info = ImageInfo( filename="test_image.jpg", - date="2024-07-29", + date=1, theme="wildlife", real=True ) @@ -33,14 +33,14 @@ def test_image_info_schema_load(): # Test loading data into ImageInfoSchema data = { "filename": "test_image.jpg", - "date": "2024-07-29", + "date": 1, "theme": "wildlife", "real": True, "status": "verified" } result = IMAGE_INFO_SCHEMA.load(data) assert result.filename == "test_image.jpg" - assert result.date == "2024-07-29" + assert result.date == 1 assert result.theme == "wildlife" assert result.real is True assert result.status == ImageStatus.VERIFIED @@ -50,13 +50,13 @@ def test_image_info_schema_load_default_status(): # Test loading data into ImageInfoSchema without status data = { "filename": "test_image.jpg", - "date": "2024-07-29", + "date": 1, "theme": "wildlife", "real": True } result = IMAGE_INFO_SCHEMA.load(data) assert result.filename == "test_image.jpg" - assert result.date == "2024-07-29" + assert result.date == 1 assert result.theme == "wildlife" assert result.real is True assert result.status == ImageStatus.UNVERIFIED @@ -66,7 +66,7 @@ def test_image_info_schema_dump(): # Test dumping ImageInfo instance to dictionary image_info = ImageInfo( filename="test_image.jpg", - date="2024-07-29", + date=1, theme="wildlife", real=True, status=ImageStatus.VERIFIED @@ -74,7 +74,7 @@ def test_image_info_schema_dump(): result = IMAGE_INFO_SCHEMA.dump(image_info) expected = { "filename": "test_image.jpg", - "date": "2024-07-29", + "date": 1, "theme": "wildlife", "real": True, "status": "verified" @@ -86,7 +86,7 @@ def test_image_info_schema_load_invalid_status(): # Test loading data with invalid status data = { "filename": "test_image.jpg", - "date": "2024-07-29", + "date": 1, "theme": "wildlife", "real": True, "status": "invalid_status"