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)
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)
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)
def test_run_empty(self): wf = WorkFlow(name='test', steps=[]) wf.run([get_test_file_path('create_action.osm')], ['/dev/null'])