Files
manual_slop/tests/test_file_item_model.py

40 lines
1.1 KiB
Python

import pytest
from src.models import FileItem
def test_file_item_fields():
"""Test that FileItem exists and has correct default values."""
item = FileItem(path="src/models.py")
assert item.path == "src/models.py"
assert item.auto_aggregate is True
assert item.force_full is False
def test_file_item_to_dict():
"""Test that FileItem can be serialized to a dict."""
item = FileItem(path="test.py", auto_aggregate=False, force_full=True)
expected = {
"path": "test.py",
"auto_aggregate": False,
"force_full": True
}
assert item.to_dict() == expected
def test_file_item_from_dict():
"""Test that FileItem can be deserialized from a dict."""
data = {
"path": "test.py",
"auto_aggregate": False,
"force_full": True
}
item = FileItem.from_dict(data)
assert item.path == "test.py"
assert item.auto_aggregate is False
assert item.force_full is True
def test_file_item_from_dict_defaults():
"""Test that FileItem.from_dict handles missing fields."""
data = {"path": "test.py"}
item = FileItem.from_dict(data)
assert item.path == "test.py"
assert item.auto_aggregate is True
assert item.force_full is False