コード例 #1
0
    def test_filter_by_physical_edge(self):
        edge = PhysicalEdgeFactory(paths=[self.seek_path])

        # filter by physical type
        data = {'physical_type': [edge.physical_type.pk]}

        qs = InterventionFilterSet(data=data).qs
        self.assertEqual(len(qs), 1)
        self.assertEqual(qs[0], self.seek_inter)
コード例 #2
0
    def test_filter_by_signage_management_edge(self):
        edge = SignageManagementEdgeFactory(paths=[self.seek_path])

        # filter by organization
        data = {'signage': [edge.organization.pk]}

        qs = InterventionFilterSet(data=data).qs

        self.assertEqual(len(qs), 1)
        self.assertEqual(qs[0], self.seek_inter)
コード例 #3
0
    def test_filter_by_competence_edge(self):
        edge = CompetenceEdgeFactory(paths=[self.seek_path])

        # filter by organization
        data = {'competence': [edge.organization.pk]}

        qs = InterventionFilterSet(data=data).qs

        self.assertEqual(len(qs), 1)
        self.assertEqual(qs[0], self.seek_inter)
コード例 #4
0
    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)
コード例 #5
0
    def test_filter_by_physical_edge(self):
        seek_inter, seek_path = self.create_pair_of_distinct_by_topo_intervention()

        edge = PhysicalEdgeFactory(no_path=True)
        PathAggregationFactory.create(topo_object=edge, path=seek_path, start_position=0, end_position=1)
        edge.reload()

        # filter by physical type
        data = {'physical_type': edge.physical_type.pk}

        qs = InterventionFilterSet(data=data).qs
        self.assertEqual(len(qs), 1)
        self.assertEqual(qs[0], seek_inter)
コード例 #6
0
    def test_filter_by_signage_management_edge(self):
        seek_inter, seek_path = self.create_pair_of_distinct_by_topo_intervention()

        edge = SignageManagementEdgeFactory(no_path=True)
        PathAggregationFactory.create(topo_object=edge, path=seek_path, start_position=0, end_position=1)
        edge.reload()

        # filter by organization
        data = {'signage': edge.organization.pk}

        qs = InterventionFilterSet(data=data).qs

        self.assertEqual(len(qs), 1)
        self.assertEqual(qs[0], seek_inter)
コード例 #7
0
 def setUp(self):
     InfrastructureInterventionFactory.create(date=datetime(2012, 11, 10))
     InfrastructureInterventionFactory.create(date=datetime(1932, 11, 10))
     self.filter = InterventionFilterSet()
     self.widget = self.filter.filters['year'].field.widget