def test_search_resources_get(test_dataset, test_fhir_store, test_patient,
                              capsys):
    fhir_resources.search_resources_get(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
    )

    out, _ = capsys.readouterr()

    assert "Using GET request" in out
Ejemplo n.º 2
0
def test_get_patient_everything(test_dataset, test_fhir_store, capsys):
    fhir_resources.create_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type)

    resource = fhir_resources.search_resources_get(service_account_json,
                                                   base_url, project_id,
                                                   cloud_region, dataset_id,
                                                   fhir_store_id,
                                                   resource_type)

    # Save the resource_id from the object returned by search_resources()
    # because you need to pass it into get_resource() and delete_resource()
    resource_id = resource["entry"][0]["resource"]["id"]

    fhir_resources.get_patient_everything(service_account_json, base_url,
                                          project_id, cloud_region, dataset_id,
                                          fhir_store_id, resource_id)

    fhir_resources.delete_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type, resource_id)

    out, _ = capsys.readouterr()

    assert 'id' in out
def test_get_patient_everything(test_dataset, test_fhir_store, capsys):
    response = fhir_resources.create_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    # Save the resource_id because you need to pass it into later tests
    resource_id = response.json()['id']

    fhir_resources.search_resources_get(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    fhir_resources.get_patient_everything(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_id)

    fhir_resources.delete_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    out, _ = capsys.readouterr()

    assert 'id' in out
def test_get_patient_everything(test_dataset, test_fhir_store, capsys):
    response = fhir_resources.create_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    # Save the resource_id because you need to pass it into later tests
    resource_id = response.json()['id']

    fhir_resources.search_resources_get(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    fhir_resources.get_patient_everything(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_id)

    fhir_resources.delete_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    out, _ = capsys.readouterr()

    assert 'id' in out
def test_get_patient_everything(test_dataset, test_fhir_store, capsys):
    fhir_resources.create_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    resource = fhir_resources.search_resources_get(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    # Save the resource_id from the object returned by search_resources()
    # because you need to pass it into get_resource() and delete_resource()
    resource_id = resource["entry"][0]["resource"]["id"]

    fhir_resources.get_patient_everything(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_id)

    fhir_resources.delete_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    out, _ = capsys.readouterr()

    assert 'id' in out
Ejemplo n.º 6
0
def test_CRUD_search_resource(test_dataset, test_fhir_store, capsys):
    fhir_resources.create_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type)

    resource = fhir_resources.search_resources_get(service_account_json,
                                                   base_url, project_id,
                                                   cloud_region, dataset_id,
                                                   fhir_store_id,
                                                   resource_type)

    # Save the resource_id from the object returned by search_resources()
    # because you need to pass it into get_resource() and delete_resource()
    resource_id = resource["entry"][0]["resource"]["id"]

    fhir_resources.get_resource(service_account_json, base_url, project_id,
                                cloud_region, dataset_id, fhir_store_id,
                                resource_type, resource_id)

    fhir_resources.update_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type, resource_id)

    fhir_resources.patch_resource(service_account_json, base_url, project_id,
                                  cloud_region, dataset_id, fhir_store_id,
                                  resource_type, resource_id)

    fhir_resources.delete_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type, resource_id)

    out, _ = capsys.readouterr()

    # Check that create/search worked
    assert 'Created Resource' in out
    assert 'id' in out
    assert 'search' in out
    assert resource_id in out
    assert 'Deleted Resource' in out
Ejemplo n.º 7
0
def test_CRUD_search_resource(test_dataset, test_fhir_store, capsys):
    response = fhir_resources.create_resource(service_account_json, base_url,
                                              project_id, cloud_region,
                                              dataset_id, fhir_store_id,
                                              resource_type)

    # Save the resource_id because you need to pass it into later tests
    resource_id = response.json()['id']

    fhir_resources.search_resources_get(service_account_json, base_url,
                                        project_id, cloud_region, dataset_id,
                                        fhir_store_id, resource_type)

    fhir_resources.get_resource(service_account_json, base_url, project_id,
                                cloud_region, dataset_id, fhir_store_id,
                                resource_type, resource_id)

    fhir_resources.update_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type, resource_id)

    fhir_resources.conditional_update_resource(service_account_json, base_url,
                                               project_id, cloud_region,
                                               dataset_id, fhir_store_id,
                                               resource_type, resource_id)

    fhir_resources.patch_resource(service_account_json, base_url, project_id,
                                  cloud_region, dataset_id, fhir_store_id,
                                  resource_type, resource_id)

    fhir_resources.conditional_patch_resource(service_account_json, base_url,
                                              project_id, cloud_region,
                                              dataset_id, fhir_store_id,
                                              resource_type, resource_id)

    history = fhir_resources.list_resource_history(service_account_json,
                                                   base_url, project_id,
                                                   cloud_region, dataset_id,
                                                   fhir_store_id,
                                                   resource_type, resource_id)

    fhir_resources.get_resource_history(
        service_account_json, base_url, project_id, cloud_region, dataset_id,
        fhir_store_id, resource_type, resource_id,
        history['entry'][-1]['resource']['meta']['versionId'])

    fhir_resources.delete_resource_purge(service_account_json, base_url,
                                         project_id, cloud_region, dataset_id,
                                         fhir_store_id, resource_type,
                                         resource_id)

    fhir_resources.conditional_delete_resource(service_account_json, base_url,
                                               project_id, cloud_region,
                                               dataset_id, fhir_store_id,
                                               resource_type, resource_id)

    fhir_resources.delete_resource(service_account_json, base_url, project_id,
                                   cloud_region, dataset_id, fhir_store_id,
                                   resource_type, resource_id)

    out, _ = capsys.readouterr()

    # Check that create/search worked
    assert 'Created Resource' in out
    assert 'id' in out
    assert 'Conditionally updated' in out
    assert 'search' in out
    assert 'link' in out
    assert ' deleted' in out
    assert resource_id in out
    assert 'Deleted Resource' in out
def test_CRUD_search_resource(test_dataset, test_fhir_store, capsys):
    fhir_resources.create_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    resource = fhir_resources.search_resources_get(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    # Save the resource_id from the object returned by search_resources()
    # because you need to pass it into get_resource() and delete_resource()
    resource_id = resource["entry"][0]["resource"]["id"]

    fhir_resources.get_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.update_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.patch_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.delete_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    out, _ = capsys.readouterr()

    # Check that create/search worked
    assert 'Created Resource' in out
    assert 'id' in out
    assert 'search' in out
    assert resource_id in out
    assert 'Deleted Resource' in out
def test_CRUD_search_resource(test_dataset, test_fhir_store, capsys):
    response = fhir_resources.create_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    # Save the resource_id because you need to pass it into later tests
    resource_id = response.json()['id']

    fhir_resources.search_resources_get(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type)

    fhir_resources.get_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.update_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.conditional_update_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.patch_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.conditional_patch_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    history = fhir_resources.list_resource_history(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.get_resource_history(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id,
        history['entry'][-1]['resource']['meta']['versionId'])

    fhir_resources.delete_resource_purge(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.conditional_delete_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    fhir_resources.delete_resource(
        service_account_json,
        base_url,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        resource_type,
        resource_id)

    out, _ = capsys.readouterr()

    # Check that create/search worked
    assert 'Created Resource' in out
    assert 'id' in out
    assert 'Conditionally updated' in out
    assert 'search' in out
    assert 'link' in out
    assert ' deleted' in out
    assert resource_id in out
    assert 'Deleted Resource' in out