def test_db_write(self, one_line_xlsx):
     from main.models import Bank
     for row in get_rows_from_blz_excel(data_file=one_line_xlsx):
         d = extract_data(row)
         dataset_number = d.pop('dataset_number')
         b, x = Bank.objects.get_or_create(dataset_number=dataset_number,
                                           defaults=d)
         assert b.name == 'Bundesbank'
    def handle(self, *args, **options):
        from main.models import Bank
        from main.utils import get_rows_from_blz_excel, extract_data

        prev_bic = None
        for element in get_rows_from_blz_excel():
            d = extract_data(element)
            dataset_number = d.pop("dataset_number")
            if not d.get("bic") and prev_bic:
                d["bic"] = prev_bic
            b, x = Bank.objects.update_or_create(dataset_number=dataset_number, defaults=d)
            prev_bic = d["bic"]
Beispiel #3
0
 def handle(self, *args, **options):
     from main.models import Bank
     from main.utils import get_rows_from_blz_excel, extract_data
     prev_bic = None
     for element in get_rows_from_blz_excel():
         d = extract_data(element)
         dataset_number = d.pop('dataset_number')
         if not d.get('bic') and prev_bic:
             d['bic'] = prev_bic
         b, x = Bank.objects.update_or_create(dataset_number=dataset_number,
                                              defaults=d)
         prev_bic = d['bic']
 def test_processing(self, one_line_xlsx):
     for row in get_rows_from_blz_excel(data_file=one_line_xlsx):
         mapping = extract_data(row)
         assert len(mapping) == 13
         assert mapping['name'] == 'Bundesbank'
         break
 def test_import(self, one_line_xlsx, key, value_type):
     for row in get_rows_from_blz_excel(data_file=one_line_xlsx):
         keys = row.keys()
         assert key in keys
         assert isinstance(row[key], value_type)