Exemple #1
0
    def test_search_properties_for_sale(self, mock_post):
        url = "https://search-gateway.dsch.ie/v1/listings"
        payload = {
            "section":
            "residential-for-sale",
            "andFilters": [{
                "name":
                "facilities",
                "values": [
                    "wired-for-cable-television",
                    "alarm",
                    "wheelchair-access",
                    "gas-fired-central-heating",
                ],
            }],
            "ranges": [
                {
                    "name": "salePrice",
                    "from": "250000",
                    "to": "300000"
                },
                {
                    "name": "numBeds",
                    "from": "3",
                    "to": "3"
                },
                {
                    "name": "ber",
                    "from": "0",
                    "to": "0"
                },
                {
                    "name": "floorSize",
                    "from": "1000",
                    "to": "1000"
                },
                {
                    "name": "firstPublishDate",
                    "from": "now-14d/d",
                    "to": ""
                },
            ],
            "geoFilter": {
                "storedShapeIds": ["3"],
                "geoSearchType": "STORED_SHAPES"
            },
            "sort":
            "priceAsc",
            "paging": {
                "from": "0",
                "pagesize": "50"
            },
        }
        headers = {
            "Content-Type": "application/json",
            "brand": "daft",
            "platform": "web",
        }

        daft = Daft()

        daft.set_search_type(SearchType.RESIDENTIAL_SALE)
        daft.set_location(Location.KILDARE)
        daft.set_location("Kildare")
        daft.set_sort_type(SortType.PRICE_ASC)
        daft.set_max_price(300000)
        daft.set_min_price(250000)
        daft.set_min_beds(3)
        daft.set_max_beds(3)
        daft.set_min_ber(Ber.A1)
        daft.set_max_ber(Ber.A1)
        daft.set_max_floor_size(1000)
        daft.set_min_floor_size(1000)
        daft.set_added_since(AddedSince.DAYS_14)
        daft.set_facility(Facility.WIRED_FOR_CABLE_TELEVISION)
        daft.set_facility(Facility.ALARM)
        daft.set_facility(Facility.WHEELCHAIR_ACCESS)
        daft.set_facility(Facility.CENTRAL_HEATING_GAS)
        daft.search()

        mock_post.assert_called_with(url, headers=headers, json=payload)
Exemple #2
0
    def test_search_properties_for_rent(self, mock_post):
        url = "https://search-gateway.dsch.ie/v1/listings"
        payload = {
            "section":
            "residential-to-rent",
            "andFilters": [{
                "name": "facilities",
                "values": ["alarm", "parking", "cable-television"],
            }],
            "ranges": [
                {
                    "name": "rentalPrice",
                    "from": "2000",
                    "to": "2500"
                },
                {
                    "name": "numBeds",
                    "from": "1",
                    "to": "2"
                },
                {
                    "name": "ber",
                    "from": "0",
                    "to": "0"
                },
                {
                    "name": "floorSize",
                    "from": "1000",
                    "to": "1000"
                },
                {
                    "name": "firstPublishDate",
                    "from": "now-14d/d",
                    "to": ""
                },
            ],
            "geoFilter": {
                "storedShapeIds": ["3"],
                "geoSearchType": "STORED_SHAPES"
            },
            "sort":
            "priceDesc",
            "paging": {
                "from": "0",
                "pagesize": "50"
            },
        }
        headers = {
            "Content-Type": "application/json",
            "brand": "daft",
            "platform": "web",
        }

        daft = Daft()

        daft.set_search_type(SearchType.RESIDENTIAL_RENT)
        daft.set_location(Location.KILDARE)
        daft.set_location("Kildare")
        daft.set_sort_type(SortType.PRICE_DESC)
        daft.set_max_price(2500)
        daft.set_min_price(2000)
        daft.set_min_beds(1)
        daft.set_max_beds(2)
        daft.set_min_ber(Ber.A1)
        daft.set_max_ber(Ber.A1)
        daft.set_max_floor_size(1000)
        daft.set_min_floor_size(1000)
        daft.set_added_since(AddedSince.DAYS_14)
        daft.set_facility(Facility.ALARM)
        daft.set_facility(Facility.PARKING)
        daft.set_facility(Facility.CABLE_TELEVISION)
        daft.search()

        mock_post.assert_called_with(url, headers=headers, json=payload)