def test_put_update_coordinates(self):
self.assertEqual(self.location_model.objects.count(), 0)
dl = self._create_object_location()
url = reverse(self.url_name, args=[dl.device.pk])
url = '{0}?key={1}'.format(url, dl.device.key)
self.assertEqual(self.location_model.objects.count(), 1)
coords = json.loads(Point(2, 23).geojson)
feature = json.dumps({'type': 'Feature', 'geometry': coords})
r = self.client.put(url, feature, content_type='application/json')
self.assertEqual(r.status_code, 200)
self.assertDictEqual(r.json(), {
'type': 'Feature',
'geometry': coords,
'properties': {'name': dl.location.name}
})
self.assertEqual(self.location_model.objects.count(), 1)
评论列表
文章目录