Пример #1
0
    def test_change_status_with_client(self):
        client = TrackingClient(base_url=self.get_url('/'),
                                io_loop=self.io_loop)

        client.change_driver_status(driver_pk='505978566e77c33341000610',
                                    data={
                                        "new_status": "available",
                                        "device_type": "android"
                                    },
                                    callback=self.stop)
        result = self.wait()
        expect(result).to_be_true()

        expect(self.pusher.calls).to_length(1)

        call = list(self.pusher.calls[-1])
        call = tuple(call)
        expect(call).to_be_like((u'driver_status', 'new_status', {
            'status': 'driver_online',
            'driver_pk': u'505978566e77c33341000610',
            'driver_device': u'android'
        }))

        cursor = self.server.application.mongo.trackings.find().sort([
            ('_id', -1)
        ]).limit(1)
        while (yield cursor.fetch_next):
            pass
Пример #2
0
    def test_change_status_with_client(self):
        client = TrackingClient(base_url=self.get_url('/'), io_loop=self.io_loop)

        client.change_driver_status(
            driver_pk='505978566e77c33341000610',
            data={"new_status": "available", "device_type": "android"},
            callback=self.stop
        )
        result = self.wait()
        expect(result).to_be_true()

        expect(self.pusher.calls).to_length(1)

        call = list(self.pusher.calls[-1])
        call = tuple(call)
        expect(call).to_be_like(
            (
                u'driver_status', 'new_status', {
                    'status': 'driver_online',
                    'driver_pk': u'505978566e77c33341000610',
                    'driver_device': u'android'
                }
            )
        )

        cursor = self.server.application.mongo.trackings.find().sort([('_id', -1)]).limit(1)
        while (yield cursor.fetch_next):
            pass
Пример #3
0
    def get(self):
        client = TrackingClient(base_url="http://local.tdispatch.com:4444/", io_loop=self.application.io_loop)

        data = {
            "new_status": "drop",
            "drop_minutes": 10,
            "device_type": "android"
        }
        client.change_driver_status("505978566e77c33341000610", data, callback=self.handle_change_driver_status)
Пример #4
0
    def get(self):
        client = TrackingClient(base_url="http://local.tdispatch.com:4444/",
                                io_loop=self.application.io_loop)

        data = {
            "new_status": "drop",
            "drop_minutes": 10,
            "device_type": "android"
        }
        client.change_driver_status("505978566e77c33341000610",
                                    data,
                                    callback=self.handle_change_driver_status)