def test_filter_by_land_edge(self): seek_inter, seek_path = self.create_pair_of_distinct_by_topo_intervention() edge = LandEdgeFactory(no_path=True) PathAggregationFactory.create(topo_object=edge, path=seek_path, start_position=0, end_position=1) edge.reload() # filter by land type data = {'land_type': edge.land_type.pk} qs = InterventionFilterSet(data=data).qs self.assertEqual(len(qs), 1) self.assertEqual(qs[0], seek_inter)
def test_filter_by_land_edge(self): edge = LandEdgeFactory(paths=[self.seek_path]) # filter by land type data = {'land_type': [edge.land_type.pk]} qs = InterventionFilterSet(data=data).qs self.assertEqual(len(qs), 1) self.assertEqual(qs[0], self.seek_inter)
def test_kind(self): from geotrek.land.models import LandEdge from geotrek.land.factories import LandEdgeFactory # Test with a concrete inheritance of Topology : LandEdge self.assertEqual('TOPOLOGY', Topology.KIND) self.assertEqual(0, len(Topology.objects.filter(kind='LANDEDGE'))) self.assertEqual('LANDEDGE', LandEdge.KIND) # Kind of instances e = LandEdgeFactory.create() self.assertEqual(e.kind, LandEdge.KIND) self.assertEqual(1, len(Topology.objects.filter(kind='LANDEDGE')))