def get_good_data(self): path = PathFactory.create() return { 'name_fr': 'Huhu', 'name_en': 'Hehe', 'departure_fr': '', 'departure_en': '', 'arrival_fr': '', 'arrival_en': '', 'published': '', 'difficulty': '', 'route': '', 'description_teaser_fr': '', 'description_teaser_en': '', 'description_fr': '', 'description_en': '', 'ambiance_fr': '', 'ambiance_en': '', 'access_fr': '', 'access_en': '', 'disabled_infrastructure_fr': '', 'disabled_infrastructure_en': '', 'duration': '0', 'is_park_centered': '', 'advised_parking': 'Very close', 'parking_location': 'POINT (1.0 1.0)', 'public_transport': 'huhu', 'advice_fr': '', 'advice_en': '', 'themes': ThemeFactory.create().pk, 'networks': TrekNetworkFactory.create().pk, 'practice': '', 'accessibilities': AccessibilityFactory.create().pk, 'web_links': WebLinkFactory.create().pk, 'information_desks': tourism_factories.InformationDeskFactory.create().pk, 'topology': '{"paths": [%s]}' % path.pk, 'trek_relationship_a-TOTAL_FORMS': '2', 'trek_relationship_a-INITIAL_FORMS': '0', 'trek_relationship_a-MAX_NUM_FORMS': '', 'trek_relationship_a-0-id': '', 'trek_relationship_a-0-trek_b': TrekFactory.create().pk, 'trek_relationship_a-0-has_common_edge': 'on', 'trek_relationship_a-0-has_common_departure': 'on', 'trek_relationship_a-0-is_circuit_step': '', 'trek_relationship_a-1-id': '', 'trek_relationship_a-1-trek_b': TrekFactory.create().pk, 'trek_relationship_a-1-has_common_edge': '', 'trek_relationship_a-1-has_common_departure': '', 'trek_relationship_a-1-is_circuit_step': 'on', }
def get_good_data(self): path = PathFactory.create() return { 'name_fr': 'Huhu', 'name_en': 'Hehe', 'departure_fr': '', 'departure_en': '', 'arrival_fr': '', 'arrival_en': '', 'published': '', 'difficulty': '', 'route': '', 'description_teaser_fr': '', 'description_teaser_en': '', 'description_fr': '', 'description_en': '', 'ambiance_fr': '', 'ambiance_en': '', 'access_fr': '', 'access_en': '', 'disabled_infrastructure_fr': '', 'disabled_infrastructure_en': '', 'duration': '0', 'is_park_centered': '', 'advised_parking': 'Very close', 'parking_location': 'POINT (1.0 1.0)', 'public_transport': 'huhu', 'advice_fr': '', 'advice_en': '', 'themes': ThemeFactory.create().pk, 'networks': TrekNetworkFactory.create().pk, 'usages': UsageFactory.create().pk, 'web_links': WebLinkFactory.create().pk, 'information_desks': InformationDeskFactory.create().pk, 'topology': '{"paths": [%s]}' % path.pk, 'trek_relationship_a-TOTAL_FORMS': '2', 'trek_relationship_a-INITIAL_FORMS': '0', 'trek_relationship_a-MAX_NUM_FORMS': '', 'trek_relationship_a-0-id': '', 'trek_relationship_a-0-trek_b': TrekFactory.create().pk, 'trek_relationship_a-0-has_common_edge': 'on', 'trek_relationship_a-0-has_common_departure': 'on', 'trek_relationship_a-0-is_circuit_step': '', 'trek_relationship_a-1-id': '', 'trek_relationship_a-1-trek_b': TrekFactory.create().pk, 'trek_relationship_a-1-has_common_edge': '', 'trek_relationship_a-1-has_common_departure': '', 'trek_relationship_a-1-is_circuit_step': 'on', }
def setUp(self): self.login() polygon = 'SRID=%s;MULTIPOLYGON(((0 0, 0 3, 3 3, 3 0, 0 0)))' % settings.SRID self.city = CityFactory(geom=polygon) self.district = DistrictFactory(geom=polygon) self.trek = TrekFactory.create( points_reference=MultiPoint([Point(0, 0), Point(1, 1)], srid=settings.SRID), parking_location=Point(0, 0, srid=settings.SRID) ) self.attachment = AttachmentFactory.create(obj=self.trek, attachment_file=get_dummy_uploaded_image()) self.information_desk = tourism_factories.InformationDeskFactory.create() self.trek.information_desks.add(self.information_desk) self.usage = UsageFactory.create() self.trek.usages.add(self.usage) self.theme = ThemeFactory.create() self.trek.themes.add(self.theme) self.network = TrekNetworkFactory.create() self.trek.networks.add(self.network) self.weblink = WebLinkFactory.create() self.trek.web_links.add(self.weblink) self.trek_b = TrekFactory.create() TrekRelationshipFactory.create(has_common_departure=True, has_common_edge=False, is_circuit_step=True, trek_a=self.trek, trek_b=self.trek_b) self.touristic_content = tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(1 1)' % settings.SRID) self.touristic_event = tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(2 2)' % settings.SRID) self.pk = self.trek.pk url = '/api/treks/%s/' % self.pk self.response = self.client.get(url) self.result = json.loads(self.response.content)
def setUp(self): self.login() polygon = 'SRID=%s;MULTIPOLYGON(((0 0, 0 3, 3 3, 3 0, 0 0)))' % settings.SRID self.city = CityFactory(geom=polygon) self.district = DistrictFactory(geom=polygon) self.parent = TrekFactory.create(published=True) self.trek = TrekFactory.create( parent=self.parent, no_path=True, points_reference=MultiPoint([Point(0, 0), Point(1, 1)], srid=settings.SRID), parking_location=Point(0, 0, srid=settings.SRID) ) path1 = PathFactory.create(geom='SRID=%s;LINESTRING(0 0, 1 0)' % settings.SRID) self.trek.add_path(path1) self.attachment = AttachmentFactory.create(obj=self.trek, attachment_file=get_dummy_uploaded_image()) self.information_desk = tourism_factories.InformationDeskFactory.create() self.trek.information_desks.add(self.information_desk) self.theme = ThemeFactory.create() self.trek.themes.add(self.theme) self.accessibility = AccessibilityFactory.create() self.trek.accessibilities.add(self.accessibility) self.network = TrekNetworkFactory.create() self.trek.networks.add(self.network) self.weblink = WebLinkFactory.create() self.trek.web_links.add(self.weblink) self.source = RecordSourceFactory.create() self.trek.source.add(self.source) self.trek_b = TrekFactory.create(no_path=True, geom='SRID=%s;POINT(2 2)' % settings.SRID, published=True) path2 = PathFactory.create(geom='SRID=%s;LINESTRING(0 1, 1 1)' % settings.SRID) self.trek_b.add_path(path2) TrekRelationshipFactory.create(has_common_departure=True, has_common_edge=False, is_circuit_step=True, trek_a=self.trek, trek_b=self.trek_b) self.touristic_content = tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(1 1)' % settings.SRID, published=True) tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(1 1)' % settings.SRID, published=False) # not published tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(1 1)' % settings.SRID, published=True).delete() # deleted tourism_factories.TouristicContentFactory(geom='SRID=%s;POINT(1000 1000)' % settings.SRID, published=True) # too far self.touristic_event = tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(2 2)' % settings.SRID, published=True) tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(2 2)' % settings.SRID, published=False) # not published tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(2 2)' % settings.SRID, published=True).delete() # deleted tourism_factories.TouristicEventFactory(geom='SRID=%s;POINT(2000 2000)' % settings.SRID, published=True) # too far trek2 = TrekFactory(no_path=True, published=False) # not published trek2.add_path(path2) trek3 = TrekFactory(no_path=True, published=True) # deleted trek3.add_path(path2) trek3.delete() trek4 = TrekFactory(no_path=True, published=True) # too far trek4.add_path(PathFactory.create(geom='SRID=%s;LINESTRING(0 2000, 1 2000)' % settings.SRID)) self.child1 = TrekFactory.create(published=False, parent=self.trek) self.child2 = TrekFactory.create(published=True, parent=self.trek) self.pk = self.trek.pk url = '/api/treks/%s/' % self.pk self.response = self.client.get(url) self.result = json.loads(self.response.content)