Ejemplo n.º 1
0
    def test_request_pickup_with_bad_string_address(self):
        (flexmock(geolocation).should_receive('geolocate').with_args(
            'some address').and_return([]))

        with self.assertRaises(UberLocationNotFound):
            self._client.request_pickup(vehicle_type=VehicleView({'id': 1}),
                                        pickup_address='some address',
                                        gps_location=self.mock_location)
Ejemplo n.º 2
0
    def test_request_pickup(self):
        (flexmock(UberClient)
            .should_receive('_send_message')
            .with_args('Pickup',
                       params={'vehicleViewId': 1, 'useCredits': True, 'pickupLocation': {'some_geo_field': '12345'}},
                       location=self.mock_location)
        )

        self._client.request_pickup(
            vehicle_type=VehicleView({'id': 1}),
            pickup_address={'some_geo_field': '12345'},
            gps_location=self.mock_location)
Ejemplo n.º 3
0
    def test_request_pickup_model_args(self):
        (flexmock(geolocation).should_receive('geolocate').with_args(
            'some address').and_return([{
                'some_geo_field': '12345'
            }]))

        (flexmock(UberClient).should_receive('_send_message').with_args(
            'Pickup',
            params={
                'vehicleViewId': 111,
                'useCredits': True,
                'paymentProfileId': 555,
                'pickupLocation': {
                    'some_geo_field': '12345'
                }
            },
            location=self.mock_location))

        self._client.request_pickup(vehicle_type=VehicleView({'id': 111}),
                                    pickup_address='some address',
                                    payment_profile=PaymentProfile({'id':
                                                                    555}),
                                    gps_location=self.mock_location)