def test_repository_list_with_price_equal_filter(room_dicts):
    repo = MemRepo(room_dicts)

    rooms = repo.list(filters={"price__eq": 60})

    assert len(rooms) == 1
    assert rooms[0].code == "913694c6-435a-4366-ba0d-da5334a611b2"
def test_repository_list_with_code_equal_filter(room_dicts):
    repo = MemRepo(room_dicts)

    rooms = repo.list(
        filters={"code__eq": "fe2c3195-aeff-487a-a08f-e0bdc0ec6e9a"})
    assert len(rooms) == 1
    assert rooms[0].code == "fe2c3195-aeff-487a-a08f-e0bdc0ec6e9a"
def test_repository_list_with_price_greater_than_filter(room_dicts):
    repo = MemRepo(room_dicts)

    rooms = repo.list(filters={"price__gt": 48})

    assert len(rooms) == 2
    assert set([r.code for r in rooms]) == {
        "913694c6-435a-4366-ba0d-da5334a611b2",
        "fe2c3195-aeff-487a-a08f-e0bdc0ec6e9a",
    }
def test_repository_list_with_price_less_than_filter(room_dicts):
    repo = MemRepo(room_dicts)

    rooms = repo.list(filters={"price__lt": 60})

    assert len(rooms) == 2
    assert set([r.code for r in rooms]) == {
        "f853578c-fc0f-4e65-81b8-566c5dffa35a",
        "eed76e77-55c1-41ce-985d-ca49bf6c0585",
    }
def test_repository_list_price_as_strings(room_dicts):
    repo = MemRepo(room_dicts)
    repo.list(filters={"price__eq": "60"})
    repo.list(filters={"price__lt": "60"})
    repo.list(filters={"price__gt": "60"})
def test_repository_list_with_price_between_filter(room_dicts):
    repo = MemRepo(room_dicts)
    rooms = repo.list(filters={"price__lt": 66, "price__gt": 48})
    assert len(rooms) == 1
    assert rooms[0].code == "913694c6-435a-4366-ba0d-da5334a611b2"
def test_repository_list_without_parameters(room_dicts):
    repo = MemRepo(room_dicts)

    rooms = [Room.from_dict(i) for i in room_dicts]

    assert repo.list() == rooms