def test_get_xml_records_can_load_xml_file(): filename = os.path.join(os.path.dirname(__file__), "test_blocklist.xml") records = get_xml_records(fields=main.CERT_ITEMS_FIELDS, filename=filename, xpath='certItems/*') assert len(records) == 10
def sync_records(fields, filename, xpath, kinto_client, bucket, collection, schema=None, with_scrapping=False, force_signature=True): xml_records = get_xml_records( fields=fields, filename=filename, xpath=xpath) kinto_records = get_kinto_records( kinto_client=kinto_client, bucket=bucket, collection=collection, schema=schema, permissions=COLLECTION_PERMISSIONS) to_create, to_delete = get_diff(xml_records, kinto_records) if with_scrapping: to_create = scrap_details_from_amo(to_create) push_changes((to_create, to_delete), kinto_client, bucket=bucket, collection=collection, to_be_signed=force_signature)