
import pytest
from sut.backend.models.location import Location

@pytest.fixture
def location():
    location = Location()
    location.id = 7
    location.name = "Rivendell"
    location.description = "Elven refuge."
    location.region = "Eriador"
    location.map_x = 1000.0
    location.map_y = 2000.0
    location.created_at = None
    return location

def test_to_dict_returns_expected_keys(location):
    # Arrange
    # (fixture)
    # Act
    result = location.to_dict()
    # Assert
    assert set(result.keys()) == {"id", "name", "description", "region", "map_x", "map_y", "created_at"}
    assert result["name"] == "Rivendell"
    assert result["region"] == "Eriador"

def test_repr_returns_expected(location):
    # Arrange
    # (fixture)
    # Act
    result = repr(location)
    # Assert
    assert "Rivendell" in result
