示例#1
0
 def test_filter_filter_out(self):
     wf = WorkFlow(name='test',
                   steps=[
                       Step(Step.STEP_IMPORT,
                            osmdata.importers.AdiffImporter, []),
                       Step(Step.STEP_FILTER, osmdata.filters.IgnoreUsers,
                            [["Yann_L"]])
                   ])
     wf.run([get_test_file_path('create_action.osm')], ['/dev/null'])
     self.assertEqual(wf.last_step_output.count(), 0)
示例#2
0
    def test_output(self):
        class _CounterExporter:
            def run(self, action_qs):
                return action_qs.count()

        wf = WorkFlow(name='test',
                      steps=[
                          Step(Step.STEP_IMPORT,
                               osmdata.importers.AdiffImporter, []),
                          Step(Step.STEP_EXPORT, _CounterExporter, [])
                      ])
        wf.run([get_test_file_path('create_action.osm')], ['/dev/null'])
        self.assertEqual(wf.last_step_output, 1)
示例#3
0
    def test_run_import(self):
        wf = WorkFlow(name='test',
                      steps=[
                          Step(Step.STEP_IMPORT,
                               osmdata.importers.AdiffImporter, [])
                      ])
        self.assertEqual(Diff.objects.count(), 1)
        self.assertEqual(ActionReport.objects.count(), 0)

        wf.run([get_test_file_path('create_action.osm')], ['/dev/null'])

        self.assertEqual(Diff.objects.count(), 2)
        # Check that action reports have been made
        self.assertEqual(ActionReport.objects.count(), 1)
示例#4
0
 def test_run_empty(self):
     wf = WorkFlow(name='test', steps=[])
     wf.run([get_test_file_path('create_action.osm')], ['/dev/null'])