def test_list_data_bundles_with_pagination(client: Client, max_results,
                                           next_token):
    response = client.list_data_bundles(service.create_model_id(),
                                        max_results=max_results,
                                        next_token=next_token)
    assert 'dataBundles' in response, 'Missing dataBundles in response'
    assert 'nextToken' in response, 'Missing nextToken in response'
示例#2
0
def test_get_document(client: Client):
    document_id = service.create_document_id()
    response = client.get_document(document_id)
    assert 'documentId' in response, 'Missing documentId in response'
    assert 'consentId' in response, 'Missing consentId in response'
    assert 'contentType' in response, 'Missing contentType in response'
    assert 'groundTruth' in response, 'Missing groundTruth in response'
示例#3
0
def test_update_document(client: Client):
    document_id = service.create_document_id()
    ground_truth = [
        {
            'label': 'total_amount',
            'value': '54.50'
        },
        {
            'label': 'purchase_date',
            'value': '2007-07-30'
        },
        {
            'label': 'secure_agreement',
            'value': True
        },
    ]

    post_document_id_response = client.update_document(
        document_id,
        ground_truth=ground_truth,
        dataset_id=service.create_dataset_id(),
    )

    assert 'groundTruth' in post_document_id_response, 'Missing groundTruth in response'
    assert 'documentId' in post_document_id_response, 'Missing documentId in response'
    assert 'consentId' in post_document_id_response, 'Missing consentId in response'
示例#4
0
def test_list_plans_with_pagination(client: Client, max_results, next_token):
    response = client.list_plans(max_results=max_results,
                                 next_token=next_token)
    assert 'plans' in response, 'Missing plans in response'
    assert 'nextToken' in response, 'Missing nextToken in response'
    for plan in response['plans']:
        assert_plan(plan)
示例#5
0
def test_update_organization(client: Client, name_and_description):
    response = client.update_organization(
        'me',
        **name_and_description,
    )
    logging.info(response)
    assert_organization(response)
示例#6
0
def test_update_asset(client: Client, name_and_description):
    asset_id = service.create_asset_id()
    content = Path('tests/remote_component.js').read_bytes()
    response = client.update_asset(asset_id,
                                   content=content,
                                   **name_and_description)
    assert 'assetId' in response, 'Missing assetId in response'
def test_list_transitions_with_pagination(client: Client, max_results,
                                          next_token):
    response = client.list_transitions(max_results=max_results,
                                       next_token=next_token)
    logging.info(response)
    assert 'transitions' in response, 'Missing transitions in response'
    assert 'nextToken' in response, 'Missing nextToken in response'
def test_update_workflow_execution(client: Client):
    response = client.update_workflow_execution(
        service.create_workflow_id(),
        service.create_workflow_execution_id(),
        service.create_transition_id(),
    )
    logging.info(response)
    assert_workflow_execution(response)
def test_list_workflow_executions_with_pagination(client: Client, max_results,
                                                  next_token):
    workflow_id = service.create_workflow_id()
    response = client.list_workflow_executions(workflow_id=workflow_id,
                                               max_results=max_results,
                                               next_token=next_token)
    assert 'workflowId' in response, 'Missing workflowId in response'
    assert 'executions' in response, 'Missing executions in response'
    assert 'nextToken' in response, 'Missing nextToken in response'
def test_get_transition_execution(client: Client):
    response = client.get_transition_execution(
        service.create_transition_id(),
        service.create_transition_execution_id(),
    )
    logging.info(response)
    assert 'transitionId' in response, 'Missing transitionId in response'
    assert 'executionId' in response, 'Missing executionId in response'
    assert 'status' in response, 'Missing status in response'
def test_create_workflow(client: Client, name_and_description, error_config,
                         completed_config):
    specification = {'definition': {}}
    response = client.create_workflow(specification,
                                      **name_and_description,
                                      error_config=error_config,
                                      completed_config=completed_config)
    logging.info(response)
    assert_workflow(response)
示例#12
0
def test_create_model(client: Client, preprocess_config, name_and_description):
    response = client.create_model(
        width=300,
        height=300,
        field_config=service.field_config(),
        preprocess_config=preprocess_config,
        **name_and_description,
    )
    logging.info(response)
    assert_model(response)
def test_update_workflow(client: Client, name_and_description, error_config,
                         completed_config):
    response = client.update_workflow(
        service.create_workflow_id(),
        error_config=error_config,
        completed_config=completed_config,
        **name_and_description,
    )
    logging.info(response)
    assert_workflow(response)
def test_update_transition(client: Client, name_and_description, in_schema,
                           out_schema):
    response = client.update_transition(
        service.create_transition_id(),
        in_schema=in_schema,
        out_schema=out_schema,
        **name_and_description,
    )
    logging.info(response)
    assert_transition(response)
def test_update_transition_parameters(client: Client, assets, environment,
                                      environment_secrets):
    response = client.update_transition(
        service.create_transition_id(),
        assets=assets,
        environment=environment,
        environment_secrets=environment_secrets,
    )
    logging.info(response)
    assert_transition(response)
示例#16
0
def test_create_app_client_without_secret(client: Client,
                                          name_and_description):
    response = client.create_app_client(
        **name_and_description,
        generate_secret=False,
        callback_urls=['http://localhost:3000/authCallback'],
        logout_urls=['http://localhost:3000/logout'],
        login_urls=['http://localhost:3000/login'],
        default_login_url='http://localhost:3000/login',
    )
    assert_app_client(response)
示例#17
0
def test_update_model(client: Client, preprocess_config, name_and_description):
    response = client.update_model(
        service.create_model_id(),
        width=300,
        height=300,
        field_config=service.field_config(),
        preprocess_config=preprocess_config,
        status='training',
        **name_and_description,
    )
    logging.info(response)
    assert_model(response)
def test_create_transition(client: Client, transition_type, parameters,
                           name_and_description):
    schema = util.create_json_schema()
    response = client.create_transition(
        transition_type,
        in_schema=schema,
        out_schema=schema,
        parameters=parameters,
        **name_and_description,
    )
    logging.info(response)
    assert_transition(response)
示例#19
0
def test_create_document(
    monkeypatch,
    client: Client,
    content,
    mime_type,
):
    consent_id = service.create_consent_id()
    post_documents_response = client.create_document(content,
                                                     mime_type,
                                                     consent_id=consent_id)

    assert 'documentId' in post_documents_response, 'Missing documentId in response'
    assert 'consentId' in post_documents_response, 'Missing consentId in response'
    assert 'contentType' in post_documents_response, 'Missing contentType in response'
def test_update_transition_execution(client: Client, status, output, error,
                                     start_time):
    transition_id = service.create_transition_id()
    execution_id = service.create_transition_execution_id()
    response = client.update_transition_execution(
        transition_id,
        execution_id,
        status,
        output=output,
        error=error,
        start_time=start_time,
    )
    logging.info(response)
    assert 'transitionId' in response, 'Missing transitionId in response'
    assert 'executionId' in response, 'Missing executionId in response'
    assert 'status' in response, 'Missing status in response'
示例#21
0
def test_delete_asset(client: Client):
    asset_id = service.create_asset_id()
    response = client.delete_asset(asset_id)
    assert 'assetId' in response, 'Missing assetId in response'
    assert 'content' in response, 'Missing content in response'
示例#22
0
def test_list_assets_with_pagination(client: Client, max_results, next_token):
    response = client.list_assets(max_results=max_results,
                                  next_token=next_token)
    assert 'assets' in response, 'Missing assets in response'
    assert 'nextToken' in response, 'Missing nextToken in response'
示例#23
0
def test_list_assets(client: Client):
    response = client.list_assets()
    logging.info(response)
    assert 'assets' in response, 'Missing assets in response'
示例#24
0
def test_create_asset(client: Client, name_and_description):
    content = Path('tests/remote_component.js').read_bytes()
    response = client.create_asset(content, **name_and_description)
    assert 'assetId' in response, 'Missing assetId in response'
示例#25
0
def test_delete_documents(client: Client, consent_id, dataset_id):
    delete_documents_response = client.delete_documents(consent_id=consent_id,
                                                        dataset_id=dataset_id)

    assert 'documents' in delete_documents_response, 'Missing documents in response'
示例#26
0
def test_list_models(client: Client):
    response = client.list_models()
    logging.info(response)
    assert 'models' in response, 'Missing models in response'
示例#27
0
def test_get_model(client: Client):
    response = client.get_model(service.create_model_id())
    logging.info(response)
    assert_model(response)
示例#28
0
def test_delete_documents_with_pagination(client: Client, max_results,
                                          next_token):
    response = client.delete_documents(max_results=max_results,
                                       next_token=next_token)
    assert 'documents' in response, 'Missing documents in response'
    assert 'nextToken' in response, 'Missing nextToken in response'
示例#29
0
def test_delete_model(client: Client):
    model_id = service.create_model_id()
    response = client.delete_model(model_id)
    assert 'modelId' in response, 'Missing modelId in response'
示例#30
0
def test_list_documents(client: Client, consent_id, dataset_id):
    response = client.list_documents(consent_id=consent_id,
                                     dataset_id=dataset_id)
    assert 'documents' in response, 'Missing documents in response'