Ejemplo n.º 1
0
 def test_create_point(self):
     """
     Tests that a point can be created.
     """
     point = Point(object=self.dummy_obj, point="SRID=4326;POINT (17.6 10.1)")
     point.save()
     self.assertEqual(point.object.name, "foo")
     self.assertEqual(point.content_type.name, "dummy model")
Ejemplo n.º 2
0
class TestKmlFeedUrls(TestCase):
    def setUp(self):
        self.dummy_foo = DummyModel(name="foo")
        self.dummy_foo.save()
        self.point_foo = Point(object=self.dummy_foo, point="SRID=4326;POINT (17.6 10.1)")
        self.point_foo.save()
        self.dummy_bar = DummyModel(name="bar")
        self.dummy_bar.save()
        self.point_bar = Point(object=self.dummy_bar, point="SRID=4326;POINT (17.6 10.1)")
        self.point_bar.save()
        self.dummy_baz = DummyModel(name="baz")
        self.dummy_baz.save()
        self.point_baz = Point(object=self.dummy_baz, point="SRID=4326;POINT (17.6 10.1)")
        self.point_baz.save()

    def test_kml_feed_view(self):
        response = self.client.get(reverse("geotags-kml_feed", kwargs={"geotag_class_name": "point"}))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context[0]["places"].count(), 3)