示例#1
0
def test_get_set_fhir_store_iam_policy(test_dataset, capsys):
    fhir_stores.create_fhir_store(service_account_json, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    get_response = fhir_stores.get_fhir_store_iam_policy(
        service_account_json, project_id, cloud_region, dataset_id,
        fhir_store_id)

    set_response = fhir_stores.set_fhir_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        "serviceAccount:[email protected]",
        "roles/viewer",
    )

    # Clean up
    fhir_stores.delete_fhir_store(service_account_json, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    out, _ = capsys.readouterr()

    assert "etag" in get_response
    assert "bindings" in set_response
    assert len(set_response["bindings"]) == 1
    assert "python-docs-samples-tests" in str(set_response["bindings"])
    assert "roles/viewer" in str(set_response["bindings"])
def test_get_set_fhir_store_iam_policy(test_dataset, capsys):
    fhir_stores.create_fhir_store(service_account_json, api_key, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    get_response = fhir_stores.get_fhir_store_iam_policy(
        service_account_json, api_key, project_id, cloud_region, dataset_id,
        fhir_store_id)

    set_response = fhir_stores.set_fhir_store_iam_policy(
        service_account_json, api_key, project_id, cloud_region, dataset_id,
        fhir_store_id,
        'serviceAccount:[email protected]',
        'roles/viewer')

    # Clean up
    fhir_stores.delete_fhir_store(service_account_json, api_key, project_id,
                                  cloud_region, dataset_id, fhir_store_id)

    out, _ = capsys.readouterr()

    assert 'etag' in get_response
    assert 'bindings' in set_response
    assert len(set_response['bindings']) == 1
    assert 'python-docs-samples-tests' in str(set_response['bindings'])
    assert 'roles/viewer' in str(set_response['bindings'])
def test_get_set_fhir_store_iam_policy(test_dataset, test_fhir_store, capsys):
    get_response = fhir_stores.get_fhir_store_iam_policy(
        project_id, location, dataset_id, fhir_store_id)

    set_response = fhir_stores.set_fhir_store_iam_policy(
        project_id,
        location,
        dataset_id,
        fhir_store_id,
        "serviceAccount:[email protected]",
        "roles/viewer",
    )

    out, _ = capsys.readouterr()

    assert "etag" in get_response
    assert "bindings" in set_response
    assert len(set_response["bindings"]) == 1
    assert "python-docs-samples-tests" in str(set_response["bindings"])
    assert "roles/viewer" in str(set_response["bindings"])
def test_get_set_fhir_store_iam_policy(test_dataset, capsys):
    fhir_stores.create_fhir_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id)

    get_response = fhir_stores.get_fhir_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id)

    set_response = fhir_stores.set_fhir_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id,
        'serviceAccount:[email protected]',
        'roles/viewer')

    # Clean up
    fhir_stores.delete_fhir_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        fhir_store_id)

    out, _ = capsys.readouterr()

    assert 'etag' in get_response
    assert 'bindings' in set_response
    assert len(set_response['bindings']) == 1
    assert 'python-docs-samples-tests' in str(set_response['bindings'])
    assert 'roles/viewer' in str(set_response['bindings'])