
import pytest
from sut.backend.models.item import Item

@pytest.fixture
def item():
    item = Item()
    item.id = 42
    item.name = "Elven Bow"
    item.description = "A bow of the elves."
    item.owner_character = "Legolas"
    item.personality_profile = "bargainer"
    item.base_price = 200
    item.asking_price = 250
    item.is_sold = False
    item.created_at = None
    item.updated_at = None
    return item

def test_to_public_dict_returns_expected_keys(item):
    # Arrange
    # (fixture)
    # Act
    result = item.to_public_dict()
    # Assert
    assert set(result.keys()) == {"id", "name", "description", "owner_character", "personality_profile", "asking_price", "is_sold", "created_at", "updated_at"}
    assert result["name"] == "Elven Bow"
    assert result["owner_character"] == "Legolas"

def test_repr_returns_expected(item):
    # Arrange
    # (fixture)
    # Act
    result = repr(item)
    # Assert
    assert "Elven Bow" in result
