Esempio n. 1
0
    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')
Esempio n. 2
0
    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')
Esempio n. 3
0
    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')
Esempio n. 5
0
def update_iati_codelists():
    from iati_synchroniser.codelist_importer import CodeListImporter
    syncer = CodeListImporter()
    syncer.synchronise_with_codelists()
Esempio n. 6
0
def update_iati_codelists():
    from iati_synchroniser.codelist_importer import CodeListImporter
    syncer = CodeListImporter()
    syncer.synchronise_with_codelists()
Esempio n. 7
0
 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')
Esempio n. 8
0
 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')
Esempio n. 9
0
 def sync_codelist(self):
     syncer = CodeListImporter()
     syncer.synchronise_with_codelists()