Beispiel #1
0
 def setUp(self):
     self.content = tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(1 1)' % settings.SRID)
     self.content2 = tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(2 2)' % settings.SRID, name="ZZZ")
     self.event = tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(50 50)' % settings.SRID)
     self.event2 = tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(60 60)' % settings.SRID, name="ZZZ")
     if settings.TREKKING_TOPOLOGY_ENABLED:
         path = core_factories.PathFactory(geom='SRID=%s;LINESTRING(0 100, 100 100)' % settings.SRID)
         self.trek = trekking_factories.TrekFactory(paths=[path])
         self.poi = trekking_factories.POIFactory(paths=[(path, 0.5, 0.5)])
     else:
         self.trek = trekking_factories.TrekFactory(geom='SRID=%s;LINESTRING(0 100, 100 100)' % settings.SRID)
         self.poi = trekking_factories.POIFactory(geom='SRID=%s;POINT(50 100)' % settings.SRID)
Beispiel #2
0
 def setUp(self):
     self.content = tourism_factories.TouristicContentFactory(
         geom='SRID=%s;POINT(1 1)' % settings.SRID)
     self.content2 = tourism_factories.TouristicContentFactory(
         geom='SRID=%s;POINT(2 2)' % settings.SRID)
     self.event = tourism_factories.TouristicEventFactory(
         geom='SRID=%s;POINT(50 50)' % settings.SRID)
     self.event2 = tourism_factories.TouristicEventFactory(
         geom='SRID=%s;POINT(60 60)' % settings.SRID)
     path = core_factories.PathFactory(
         geom='SRID=%s;LINESTRING(0 100, 100 100)' % settings.SRID)
     self.trek = trekking_factories.TrekFactory(no_path=True)
     self.trek.add_path(path)
     self.poi = trekking_factories.POIFactory(no_path=True)
     self.poi.add_path(path, start=0.5, end=0.5)
    def setUpTestData(cls):
        cls.nb_treks = 1

        cls.treks = trek_factory.TrekWithPublishedPOIsFactory.create_batch(
            cls.nb_treks, name_fr='Coucou', description_fr="Sisi",
            description_teaser_fr="mini", published_fr=True,
            points_reference=MultiPoint([Point(0, 0), Point(1, 1)], srid=settings.API_SRID),
            parking_location=Point(0, 0, srid=settings.API_SRID))
        cls.trek = cls.treks[0]
        cls.trek_parent = trek_factory.TrekFactory(name_fr='Parent', description_fr="Parent_1",
                                                   description_teaser_fr="Parent_1", published_fr=True)
        cls.trek_child_published = trek_factory.TrekFactory(name_fr='Child_published',
                                                            description_fr="Child_published_1",
                                                            description_teaser_fr="Child_published_1",
                                                            published_fr=True)
        cls.trek_child_not_published = trek_factory.TrekFactory(name_fr='Child_not_published',
                                                                description_fr="Child_not_published_1",
                                                                description_teaser_fr="Child_not_published_1",
                                                                published_fr=False, published_en=True, published=False)
        trek_models.OrderedTrekChild(parent=cls.trek_parent, child=cls.trek_child_published, order=1).save()
        trek_models.OrderedTrekChild(parent=cls.trek_parent, child=cls.trek_child_not_published, order=0).save()

        cls.trek_parent_not_published = trek_factory.TrekFactory(name_fr='Parent_not_published',
                                                                 description_fr="Parent_not_published_1",
                                                                 description_teaser_fr="Parent_not_published_1",
                                                                 published_fr=False, published_en=True, published=False)
        cls.trek_child_published_2 = trek_factory.TrekFactory(name_fr='Child_published_2',
                                                              description_fr="Child_published_2",
                                                              description_teaser_fr="Child_published_2",
                                                              published_fr=True)
        cls.trek_child_not_published_2 = trek_factory.TrekFactory(name_fr='Child_not_published_2',
                                                                  description_fr="Child_not_published_2",
                                                                  description_teaser_fr="Child_not_published_2",
                                                                  published_fr=False, published_en=True,
                                                                  published=False)
        trek_models.OrderedTrekChild(parent=cls.trek_parent_not_published,
                                     child=cls.trek_child_published_2, order=2).save()
        trek_models.OrderedTrekChild(parent=cls.trek_parent_not_published,
                                     child=cls.trek_child_not_published_2, order=1).save()

        cls.touristic_content = tourism_factory.TouristicContentFactory(geom=cls.treks[0].published_pois.first().geom,
                                                                        name_fr='Coucou_Content', description_fr="Sisi",
                                                                        description_teaser_fr="mini", published_fr=True)

        cls.touristic_event = tourism_factory.TouristicEventFactory(geom=cls.treks[0].published_pois.first().geom,
                                                                    name_fr='Coucou_Event', description_fr="Sisi_Event",
                                                                    description_teaser_fr="mini", published_fr=True)
        cls.district = zoning_factory.DistrictFactory(geom=MultiPolygon(Polygon.from_bbox(cls.treks[0].geom.extent)))
        bigger_extent = (cls.treks[0].geom.extent[0] - 1, cls.treks[0].geom.extent[1] - 1,
                         cls.treks[0].geom.extent[2] + 1, cls.treks[0].geom.extent[3] + 1)
        cls.city = zoning_factory.CityFactory(geom=MultiPolygon(Polygon.from_bbox(bigger_extent)))
Beispiel #4
0
 def test_dates_display_end_begin_date_different(self):
     date_1 = datetime.datetime(year=2000, month=1, day=12)
     date_2 = datetime.datetime(year=2001, month=1, day=12)
     event = tourism_factories.TouristicEventFactory(begin_date=date_1, end_date=date_2)
     self.assertEqual('from 01/12/2000 to 01/12/2001', event.dates_display)
Beispiel #5
0
 def test_dates_display_no_end_begin_date(self):
     event = tourism_factories.TouristicEventFactory(begin_date=None, end_date=None)
     self.assertEqual('', event.dates_display)
Beispiel #6
0
 def test_dates_display_same_date(self):
     date = datetime.datetime(year=2000, month=1, day=12)
     event = tourism_factories.TouristicEventFactory(begin_date=date, end_date=date)
     self.assertEqual('01/12/2000', event.dates_display)