def test_get_set_dicom_store_iam_policy(test_dataset, capsys):
    dicom_stores.create_dicom_store(service_account_json, project_id,
                                    cloud_region, dataset_id, dicom_store_id)

    get_response = dicom_stores.get_dicom_store_iam_policy(
        service_account_json, project_id, cloud_region, dataset_id,
        dicom_store_id)

    set_response = dicom_stores.set_dicom_store_iam_policy(
        service_account_json, project_id, cloud_region, dataset_id,
        dicom_store_id,
        'serviceAccount:[email protected]',
        'roles/viewer')

    # Clean up
    dicom_stores.delete_dicom_store(service_account_json, project_id,
                                    cloud_region, dataset_id, dicom_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_CRUD_dicom_store(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.get_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.list_dicom_stores(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id)

    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert 'Created DICOM store' in out
    assert 'Name' in out
    assert 'dicomStores' in out
    assert 'Deleted DICOM store' in out
def test_patch_dicom_store(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.patch_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        pubsub_topic)

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    assert 'Patched DICOM store' in out
def test_export_dicom_instance(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.export_dicom_instance(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        bucket)

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    assert 'Exported DICOM instance' in out
def test_export_dicom_instance(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.export_dicom_instance(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        bucket)

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    assert 'Exported DICOM instance' in out
def test_patch_dicom_store(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.patch_dicom_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        pubsub_topic)

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    assert 'Patched DICOM store' in out
def test_CRUD_dicom_store(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.get_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.list_dicom_stores(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id)

    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert 'Created DICOM store' in out
    assert 'Name' in out
    assert 'dicomStores' in out
    assert 'Deleted DICOM store' in out
def test_import_dicom_instance(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    dicom_stores.import_dicom_instance(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        content_uri)

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    out, _ = capsys.readouterr()

    assert 'Imported DICOM instance' in out
Beispiel #9
0
 def create():
     try:
         dicom_stores.create_dicom_store(project_id, location, dataset_id,
                                         dicom_store_id)
     except HttpError as err:
         # We ignore 409 conflict here, because we know it's most
         # likely the first request failed on the client side, but
         # the creation suceeded on the server side.
         if err.resp.status == 409:
             print("Got exception {} while creating DICOM store".format(
                 err.resp.status))
         else:
             raise
Beispiel #10
0
def test_import_dicom_instance(test_dataset, capsys):
    dicom_stores.create_dicom_store(service_account_json, api_key, project_id,
                                    cloud_region, dataset_id, dicom_store_id)

    dicom_stores.import_dicom_instance(service_account_json, api_key,
                                       project_id, cloud_region, dataset_id,
                                       dicom_store_id, content_uri)

    # Clean up
    dicom_stores.delete_dicom_store(service_account_json, api_key, project_id,
                                    cloud_region, dataset_id, dicom_store_id)

    out, _ = capsys.readouterr()

    assert 'Imported DICOM instance' in out
def test_CRUD_dicom_store(test_dataset, crud_dicom_store_id, capsys):
    dicom_stores.create_dicom_store(project_id, cloud_region, dataset_id,
                                    crud_dicom_store_id)

    dicom_stores.get_dicom_store(project_id, cloud_region, dataset_id,
                                 crud_dicom_store_id)

    dicom_stores.list_dicom_stores(project_id, cloud_region, dataset_id)

    dicom_stores.delete_dicom_store(project_id, cloud_region, dataset_id,
                                    crud_dicom_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert "Created DICOM store" in out
    assert "name" in out
    assert "dicomStores" in out
    assert "Deleted DICOM store" in out
Beispiel #12
0
def test_dicom_store():
    dicom_store = dicom_stores.create_dicom_store(service_account_json,
                                                  project_id, cloud_region,
                                                  dataset_id, dicom_store_id)

    yield dicom_store

    # Clean up
    dicom_stores.delete_dicom_store(service_account_json, project_id,
                                    cloud_region, dataset_id, dicom_store_id)
def test_get_set_dicom_store_iam_policy(test_dataset, capsys):
    dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    get_response = dicom_stores.get_dicom_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    set_response = dicom_stores.set_dicom_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id,
        'serviceAccount:[email protected]',
        'roles/viewer')

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_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_dicom_store():
    dicom_store = dicom_stores.create_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)

    yield dicom_store

    # Clean up
    dicom_stores.delete_dicom_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        dicom_store_id)
Beispiel #15
0
 def create():
     dicom_stores.create_dicom_store(project_id, location, dataset_id,
                                     crud_dicom_store_id)
 def create():
     dicom_stores.create_dicom_store(project_id, cloud_region, dataset_id,
                                     crud_dicom_store_id)