def test_CRUD_hl7v2_store(test_dataset, capsys):
    hl7v2_stores.create_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    hl7v2_stores.get_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    hl7v2_stores.list_hl7v2_stores(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id)

    hl7v2_stores.delete_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert 'Created HL7v2 store' in out
    assert 'Name' in out
    assert 'hl7V2Stores' in out
    assert 'Deleted HL7v2 store' in out
def test_get_set_hl7v2_store_iam_policy(test_dataset, capsys):
    hl7v2_stores.create_hl7v2_store(service_account_json, project_id,
                                    cloud_region, dataset_id, hl7v2_store_id)

    get_response = hl7v2_stores.get_hl7v2_store_iam_policy(
        service_account_json, project_id, cloud_region, dataset_id,
        hl7v2_store_id)

    set_response = hl7v2_stores.set_hl7v2_store_iam_policy(
        service_account_json, project_id, cloud_region, dataset_id,
        hl7v2_store_id,
        'serviceAccount:[email protected]',
        'roles/viewer')

    # Clean up
    hl7v2_stores.delete_hl7v2_store(service_account_json, project_id,
                                    cloud_region, dataset_id, hl7v2_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_patch_hl7v2_store(test_dataset, capsys):
    hl7v2_stores.create_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    hl7v2_stores.patch_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    # Clean up
    hl7v2_stores.delete_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    out, _ = capsys.readouterr()

    assert 'Patched HL7v2 store' in out
Example #4
0
def test_patch_hl7v2_store(test_dataset, capsys):
    hl7v2_stores.create_hl7v2_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    hl7v2_stores.patch_hl7v2_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id,
        pubsub_topic)

    # Clean up
    hl7v2_stores.delete_hl7v2_store(
        service_account_json,
        api_key,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    out, _ = capsys.readouterr()

    assert 'Patched HL7v2 store' in out
Example #5
0
def test_CRUD_hl7v2_store(test_dataset, capsys):
    hl7v2_stores.create_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    hl7v2_stores.get_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    hl7v2_stores.list_hl7v2_stores(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id)

    hl7v2_stores.delete_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert 'Created HL7v2 store' in out
    assert 'Name' in out
    assert 'hl7V2Stores' in out
    assert 'Deleted HL7v2 store' in out
def test_hl7v2_store():
    hl7v2_store = hl7v2_stores.create_hl7v2_store(service_account_json,
                                                  project_id, cloud_region,
                                                  dataset_id, hl7v2_store_id)

    yield hl7v2_store

    hl7v2_stores.delete_hl7v2_store(service_account_json, project_id,
                                    cloud_region, dataset_id, hl7v2_store_id)
Example #7
0
 def clean_up():
     try:
         hl7v2_stores.delete_hl7v2_store(project_id, cloud_region,
                                         dataset_id, hl7v2_store_id)
     except HttpError as err:
         # The API returns 403 when the HL7v2 store doesn't exist.
         if err.resp.status == 404 or err.resp.status == 403:
             print("Got exception {} while deleting HL7v2 store".format(
                 err.resp.status))
         else:
             raise
def test_hl7v2_store():
    hl7v2_store = hl7v2_stores.create_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    yield hl7v2_store

    hl7v2_stores.delete_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)
Example #9
0
def test_CRUD_hl7v2_store(test_dataset, crud_hl7v2_store_id, capsys):
    hl7v2_stores.create_hl7v2_store(project_id, cloud_region, dataset_id,
                                    hl7v2_store_id)

    hl7v2_stores.get_hl7v2_store(project_id, cloud_region, dataset_id,
                                 hl7v2_store_id)

    hl7v2_stores.list_hl7v2_stores(project_id, cloud_region, dataset_id)

    hl7v2_stores.delete_hl7v2_store(project_id, cloud_region, dataset_id,
                                    hl7v2_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert "Created HL7v2 store" in out
    assert "Name" in out
    assert "hl7V2Stores" in out
    assert "Deleted HL7v2 store" in out
def test_get_set_hl7v2_store_iam_policy(test_dataset, capsys):
    hl7v2_stores.create_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    get_response = hl7v2_stores.get_hl7v2_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id)

    set_response = hl7v2_stores.set_hl7v2_store_iam_policy(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_store_id,
        'serviceAccount:[email protected]',
        'roles/viewer')

    # Clean up
    hl7v2_stores.delete_hl7v2_store(
        service_account_json,
        project_id,
        cloud_region,
        dataset_id,
        hl7v2_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'])
Example #11
0
def test_CRUD_hl7v2_store(test_dataset, crud_hl7v2_store_id, capsys):
    @backoff.on_exception(backoff.expo, HttpError, max_time=60)
    def create():
        hl7v2_stores.create_hl7v2_store(
            project_id, location, dataset_id, hl7v2_store_id
        )

    create()

    hl7v2_stores.get_hl7v2_store(project_id, location, dataset_id, hl7v2_store_id)

    hl7v2_stores.list_hl7v2_stores(project_id, location, dataset_id)

    hl7v2_stores.delete_hl7v2_store(project_id, location, dataset_id, hl7v2_store_id)

    out, _ = capsys.readouterr()

    # Check that create/get/list/delete worked
    assert "Created HL7v2 store" in out
    assert "Name" in out
    assert "hl7V2Stores" in out
    assert "Deleted HL7v2 store" in out