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

        client.update_driver_location(driver_pk=driver_pk,
                                      data={
                                          "latitude": 52.573012,
                                          "longitude": 13.6203
                                      },
                                      callback=self.stop)
        result = self.wait()
        expect(result.code).to_equal(200)
        expect(result.body).to_equal('OK')

        client.get_driver_location(driver_pk=driver_pk, callback=self.stop)
        result = self.wait()
        expect(result).not_to_be_null()

        expect(result[0]["tracking_id"]).to_equal(driver_pk)
        expect(result[0]["location"]).to_be_like({
            'lat': 52.573012,
            'lng': 13.6203
        })
        expect(result[0]["timestamp"]).to_be_true()
Пример #2
0
    def test_update_driver_location_with_client(self):
        client = TrackingClient(base_url=self.get_url('/'), io_loop=self.io_loop)

        client.update_driver_location(
            driver_pk='505978566e77c33341000610',
            data={"latitude": 52.573012, "longitude": 13.6203},
            callback=self.stop
        )
        result = self.wait()
        expect(result.code).to_equal(200)
        expect(result.body).to_equal('OK')

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

        call = list(self.pusher.calls[-1])
        call = tuple(call)
        expect(call).to_be_like(
            (u'driver_location', 'new_location', {'lat': 52.573012, 'lng': 13.6203})
        )
Пример #3
0
    def test_update_driver_location_with_client(self):
        client = TrackingClient(base_url=self.get_url('/'),
                                io_loop=self.io_loop)

        client.update_driver_location(driver_pk='505978566e77c33341000610',
                                      data={
                                          "latitude": 52.573012,
                                          "longitude": 13.6203
                                      },
                                      callback=self.stop)
        result = self.wait()
        expect(result.code).to_equal(200)
        expect(result.body).to_equal('OK')

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

        call = list(self.pusher.calls[-1])
        call = tuple(call)
        expect(call).to_be_like((u'driver_location', 'new_location', {
            'lat': 52.573012,
            'lng': 13.6203
        }))
Пример #4
0
    def test_get_driver_location_with_client(self):
        client = TrackingClient(base_url=self.get_url('/'), io_loop=self.io_loop)
        driver_pk = '505978566e77c33341000611'

        client.update_driver_location(
            driver_pk=driver_pk,
            data={"latitude": 52.573012, "longitude": 13.6203},
            callback=self.stop
        )
        result = self.wait()
        expect(result.code).to_equal(200)
        expect(result.body).to_equal('OK')

        client.get_driver_location(
            driver_pk=driver_pk,
            callback=self.stop
        )
        result = self.wait()
        expect(result).not_to_be_null()

        expect(result[0]["tracking_id"]).to_equal(driver_pk)
        expect(result[0]["location"]).to_be_like({'lat': 52.573012, 'lng': 13.6203})
        expect(result[0]["timestamp"]).to_be_true()