def test__FacilityQuery__is_eligible_to_retire__sector_does_not_exists__returns_nothing(
        seeded_session, ggo_sector):

    ggo = Mock(sector='NO-FACILITIES-HAS-THIS-SECTOR')

    query = FacilityQuery(seeded_session) \
        .is_eligible_to_retire(ggo)

    assert query.count() == 0
def test__FacilityQuery__is_eligible_to_retire__sector_exists__returns_correct_facilities(
        seeded_session, ggo_sector):

    ggo = Mock(sector=ggo_sector)

    query = FacilityQuery(seeded_session) \
        .is_eligible_to_retire(ggo)

    assert query.count() > 0
    assert all(f.sector == ggo_sector for f in query.all())
    assert all(f.facility_type == FacilityType.CONSUMPTION for f in query.all())
def test__FacilityQuery__belongs_to__Facility_does_not_exists__returns_nothing(seeded_session):

    query = FacilityQuery(seeded_session) \
        .belongs_to(user4)

    assert query.count() == 0