def test_synchronise_with_codelists(self): importer = CodeListImporter() importer.get_codelist_data = MagicMock() importer.loop_through_codelists = MagicMock() importer.synchronise_with_codelists() self.assertEqual(9, importer.get_codelist_data.call_count) self.assertEqual(len(importer.iati_versions), importer.loop_through_codelists.call_count) importer.get_codelist_data.assert_called_with(name='DocumentCategory-category') importer.loop_through_codelists.assert_called_with('2.01')
def test_synchronise_with_codelists(self): importer = CodeListImporter() importer.get_codelist_data = MagicMock() importer.loop_through_codelists = MagicMock() importer.synchronise_with_codelists() self.assertEqual(10, importer.get_codelist_data.call_count) self.assertEqual(len(importer.iati_versions), importer.loop_through_codelists.call_count) importer.get_codelist_data.assert_called_with( name='DocumentCategory-category') importer.loop_through_codelists.assert_called_with('2.02')
def test_synchronise_with_codelists(self): importer = CodeListImporter() importer.get_codelist_data = MagicMock() importer.loop_through_codelists = MagicMock() importer.synchronise_with_codelists() self.assertEqual(len(importer.CODELIST_ITEMS_TO_PARSE), importer.get_codelist_data.call_count) self.assertEqual(len(importer.iati_versions), importer.loop_through_codelists.call_count) last_synced_codelist = importer.CODELIST_ITEMS_TO_PARSE[ len(importer.CODELIST_ITEMS_TO_PARSE) - 1] importer.get_codelist_data.assert_called_with( name=last_synced_codelist) importer.loop_through_codelists.assert_called_with('2.03')
def test_synchronise_with_codelists(self): importer = CodeListImporter() importer.get_codelist_data = MagicMock() importer.loop_through_codelists = MagicMock() importer.synchronise_with_codelists() self.assertEqual( len(importer.CODELIST_ITEMS_TO_PARSE), importer.get_codelist_data.call_count ) self.assertEqual(len(importer.iati_versions), importer.loop_through_codelists.call_count) last_synced_codelist = importer.CODELIST_ITEMS_TO_PARSE[ len(importer.CODELIST_ITEMS_TO_PARSE) - 1 ] importer.get_codelist_data.assert_called_with( name=last_synced_codelist ) importer.loop_through_codelists.assert_called_with('2.03')
def update_iati_codelists(): from iati_synchroniser.codelist_importer import CodeListImporter syncer = CodeListImporter() syncer.synchronise_with_codelists()
def update_iati_codelists(): from iati_synchroniser.codelist_importer import CodeListImporter syncer = CodeListImporter() syncer.synchronise_with_codelists()
def sync_view(self, request): sync_id = request.GET.get('sync_id') from iati_synchroniser.codelist_importer import CodeListImporter cli = CodeListImporter() cli.synchronise_with_codelists() return HttpResponse('Success')
def sync_view(self, request): sync_id = request.GET.get('sync_id') from iati_synchroniser.codelist_importer import CodeListImporter cli = CodeListImporter() cli.synchronise_with_codelists() return HttpResponse('Success')
def sync_codelist(self): syncer = CodeListImporter() syncer.synchronise_with_codelists()