Exemple #1
0
def test_import_fhir_store_gcs(test_dataset, capsys):
    fhir_stores.create_fhir_store(service_account_json, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    storage_client = storage.Client()
    bucket = storage_client.get_bucket(gcs_uri)
    blob = bucket.blob(source_file_name)

    blob.upload_from_filename(resource_file)

    time.sleep(10)  # Give new blob time to propagate
    fhir_stores.import_fhir_resources(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        import_object,
    )

    # Clean up
    try:
        blob.delete()
    # If blob not found, then it's already been deleted, so no need to clean up.
    except exceptions.NotFound:
        pass

    fhir_stores.delete_fhir_store(service_account_json, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    out, _ = capsys.readouterr()

    assert "Imported FHIR resources" in out
Exemple #2
0
def test_import_fhir_store_gcs(test_dataset, test_fhir_store, blob, capsys):
    fhir_stores.import_fhir_resources(
        project_id, cloud_region, dataset_id, fhir_store_id, import_object,
    )

    out, _ = capsys.readouterr()
    assert "Imported FHIR resources" in out
def test_import_fhir_store_gcs(test_dataset, capsys):
    fhir_stores.create_fhir_store(service_account_json, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    storage_client = storage.Client()
    bucket = storage_client.get_bucket(gcs_uri)
    blob = bucket.blob(source_file_name)

    blob.upload_from_filename(resource_file)

    time.sleep(10)  # Give new blob time to propagate
    fhir_stores.import_fhir_resources(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        import_object,
    )

    # Clean up
    blob.delete()

    fhir_stores.delete_fhir_store(service_account_json, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    out, _ = capsys.readouterr()

    assert "Imported FHIR resources" in out
def test_import_fhir_store_gcs(test_dataset, test_fhir_store, test_blob,
                               capsys):

    time.sleep(10)  # Give new blob time to propagate

    fhir_stores.import_fhir_resources(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        test_fhir_store_id,
        import_object,
    )

    out, _ = capsys.readouterr()

    assert "Imported FHIR resources" in out