def test_popit_import_persons(self): popolo_importer = PopoloImporter(self.popit_url) popolo_importer.import_all() self.assertEqual( Speaker.objects.filter(instance=popolo_importer.instance).count(), 3)
def test_popit_import_persons(self): popit_importer = PopoloImporter(self.popit_url) popit_importer.import_all() self.assertEqual( Speaker.objects.filter(instance=popit_importer.instance).count(), 3, )
def test_import_persons(self): popolo_importer = PopoloImporter( 'speeches/tests/data/fake_http/welsh_assembly.json') popolo_importer.import_all() self.assertEqual( Speaker.objects.filter(instance=popolo_importer.instance).count(), 3, )
def test_popolo_import_remote_single_json_file(self): popolo_importer = PopoloImporter( 'http://example.com/welsh_assembly.json') popolo_importer.import_all() self.assertEqual( Speaker.objects.filter(instance=popolo_importer.instance).count(), 3, )
def test_import_persons(self): popolo_importer = PopoloImporter( 'speeches/tests/data/fake_http/welsh_assembly.json' ) popolo_importer.import_all() self.assertEqual( Speaker.objects.filter(instance=popolo_importer.instance).count(), 3, )
def test_popolo_import_remote_single_json_file(self): popolo_importer = PopoloImporter( 'http://example.com/welsh_assembly.json' ) popolo_importer.import_all() self.assertEqual( Speaker.objects.filter(instance=popolo_importer.instance).count(), 3, )
def clean(self): cleaned_data = super(PopoloImportForm, self).clean() cleaned_data['importer'] = PopoloImporter( cleaned_data['location'], instance=self.instance, ) return cleaned_data
def handle(self, *args, **options): if not args: raise CommandError('Please specify a source URL or file') base_url = args[0] if len(args) == 2: instance_label = args[1] try: instance = Instance.objects.get(label=instance_label) except Instance.DoesNotExist: raise CommandError( 'There is no instance with label %s' % instance_label) else: instance = None if len(args) > 2: raise CommandError('Too many arguments: %s' % repr(args)) importer = PopoloImporter(base_url, instance=instance) importer.import_all()
def handle(self, *args, **options): if not args: raise CommandError('Please specify a source URL or file') base_url = args[0] if len(args) == 2: instance_label = args[1] try: instance = Instance.objects.get(label=instance_label) except Instance.DoesNotExist: raise CommandError('There is no instance with label %s' % instance_label) else: instance = None if len(args) > 2: raise CommandError('Too many arguments: %s' % repr(args)) importer = PopoloImporter(base_url, instance=instance) importer.import_all()