Пример #1
0
 def remove_operation_configs():
     configs = operation_configs + session_operation_configs + udi_operation_configs
     for config in configs:
         workflow = {}
         workflow["Name"] = "_testoperation" + config["Name"]
         api.delete_operation_workflow_request(workflow, stack_resources)
         operation = {}
         operation["Name"] = config["Name"]
         api.delete_operation_request(operation, stack_resources)
Пример #2
0
def test_operation_delete(udi_operations, stack_resources):

    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    print("\nTesting operation deletes")

    print("Delete an operation that is not part of a workflow or stage")
    config = udi_operations[0]
    operation = {}
    operation["Name"] = config["Name"]

    print("\nOPERATION CONFIGURATION: {}".format(config))
    delete_operation_response = api.delete_operation_request(
        operation, stack_resources)
    assert delete_operation_response.status_code == 200
    old_operation = delete_operation_response.json()

    # give some time for the state machine to delete
    time.sleep(45)

    print("Re-create the operation that is not part of a workflow or stage")
    # Create the operation
    create_operation_response = api.create_operation_request(
        config, stack_resources)
    print(create_operation_response.json())
    assert create_operation_response.status_code == 200
    new_operation = create_operation_response.json()

    assert old_operation["Id"] != new_operation["Id"]
Пример #3
0
def udi_operations(udi_operation_configs, stack_resources, api_schema):

    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    print("Creating update/delete test operations")
    for config in udi_operation_configs:

        print("\nOPERATION CONFIGURATION: {}".format(config))

        # Create the operation
        create_operation_response = api.create_operation_request(
            config, stack_resources)
        operation = create_operation_response.json()

        assert create_operation_response.status_code == 200
        #validation.schema(operation, api_schema["create_operation_response"])
        validation.schema(operation, api_schema["create_operation_response"])

    yield udi_operation_configs

    for config in udi_operation_configs:
        #Delete the operation
        operation = {}
        operation["Name"] = config["Name"]

        delete_operation_response = api.delete_operation_request(
            operation, stack_resources)
        assert delete_operation_response.status_code == 200
Пример #4
0
def test_operation_api(operation_configs, stack_resources, api_schema):

    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    print("Running /workflow/operation API tests")
    for config in operation_configs:
        print("\n----------------------------------------")
        print("\nTEST CONFIGURATION: {}".format(config))

        # Create the operation
        create_operation_response = api.create_operation_request(
            config, stack_resources)
        operation = create_operation_response.json()

        assert create_operation_response.status_code == 200
        #validation.schema(operation, api_schema["create_operation_response"])
        validation.schema(operation, api_schema["create_operation_response"])

        get_operation_response = api.get_operation_request(
            operation, stack_resources)
        operation = create_operation_response.json()
        assert get_operation_response.status_code == 200
        validation.schema(operation, api_schema["create_operation_response"])

        # Create a singleton workflow to test executing this operation
        create_workflow_response = api.create_operation_workflow_request(
            operation, stack_resources)
        workflow = create_workflow_response.json()
        assert create_workflow_response.status_code == 200
        # FIXME - need to update schema manually
        # #validation.schema(workflow, api_schema["create_workflow_response"])

        # Execute the operation and wait for it to complete
        create_workflow_execution_response = api.create_workflow_execution_request(
            workflow, config, stack_resources)
        workflow_execution = create_workflow_execution_response.json()
        assert create_workflow_execution_response.status_code == 200
        assert workflow_execution['Status'] == 'Queued'
        # FIXME - need schema
        # #validation.schema(workflow_execution, api_schema["create_workflow_execution_response"])
        workflow_execution = api.wait_for_workflow_execution(
            workflow_execution, stack_resources, 120)
        if config["Status"] == "OK":
            assert workflow_execution["Status"] == "Complete"

            # FIXME - validate the execution result
            # Check output media, metadata, operation status, workflow status, ....
        else:
            assert workflow_execution["Status"] == "Error"

        validation.operation_execution(workflow_execution, config,
                                       stack_resources, api_schema)

        # Delete the workflow
        delete_workflow_response = api.delete_operation_workflow_request(
            workflow, stack_resources)
        assert delete_workflow_response.status_code == 200

        #Delete the operation
        delete_operation_response = api.delete_operation_request(
            operation, stack_resources)
        assert delete_operation_response.status_code == 200


#TODO: dynamoDB remove asset