Пример #1
0
class RunDataModel(AbstractAPIModel):
    """Run data model structure."""
    TITLE = "RunData"
    PROPERTIES = [
        StringField(name="run_name"),
        StringField(name="artifact_path"),
        BoolField(name="run_delta"),
        StringField(name="user_name"),
        StringField(name="config"),
    ]
Пример #2
0
class ReleaseResourcesParamsModel(AbstractAPIModel):
    """Release the given resources names.

    Args:
        resources (list): list of str. resource names to be released.
    """
    PROPERTIES = [
        ArrayField(name="resources", items_type=StringField("resource_name"),
                   example=["calc1", "calc2"], required=True),
        StringField(name="token", required=True)
    ]
Пример #3
0
class TokenResponseModel(AbstractResponse):
    """Returns a token of the created sessions."""
    TITLE = "Token Response"
    PROPERTIES = [
        StringField(name="token",
                    description="Token of the current session",
                    required=True)
    ]
Пример #4
0
class SignatureControlParamsModel(AbstractAPIModel):
    """Model structure of signature control operation.

    Args:
        error (str): error message.
    """
    PROPERTIES = [
        StringField(name="error", required=True),
    ]
Пример #5
0
class StatisticsRequestModel(AbstractAPIModel):
    """Model that contains name of a test or component."""
    PROPERTIES = [
        StringField(name="test_name", required=True),
        NumberField(name="max_sample_size", required=False),
        NumberField(name="min_duration_cut", required=False),
        NumberField(name="max_iterations", required=False),
        NumberField(name="acceptable_ratio", required=False)
    ]
Пример #6
0
class TestModel(AbstractAPIModel):
    """Test model structure.

    Args:
        id (number): the id of the test.
        name (str): the name of the test.
        class (str): the classname of the test.
        subtests (list): list of TestModel. Sub-tests of the current test.
    """
    TITLE = "Test"
    PROPERTIES = [
        NumberField(name="id"),
        StringField(name="name"),
        StringField(name="class"),
        ArrayField(name="subtests",
                   items_type=DynamicType("TestModel",
                                          "rotest.api.common.models"))
    ]
Пример #7
0
class SignatureResponse(AbstractResponse):
    """Returns in response to get or create signature data action.

    The response contains data of a matching signature if there is one.
    """
    PROPERTIES = [
        BoolField(name="is_new", required=True),
        NumberField(name="id", required=True),
        StringField(name="link", required=True)
    ]
Пример #8
0
class TestResultModel(AbstractAPIModel):
    """Describes the result of a test.

    Args:
        result_code (number): the end result code of the test.
        info (str): additional info of the test run.
    """
    PROPERTIES = [
        NumberField(name="result_code", required=True),
        StringField(name="info", required=True)
    ]
Пример #9
0
class UpdateRunDataParamsModel(AbstractAPIModel):
    """Update run data of a given session run.

    Args:
        run_data (RunDataModel): the new run data to update to.
        token (str): the token of the current session run.
    """
    PROPERTIES = [
        ModelField(name="run_data", model=RunDataModel, required=True),
        StringField(name="token", required=True)
    ]
Пример #10
0
class TestControlOperationParamsModel(AbstractAPIModel):
    """Generic data structure of test control operations.

    Args:
        token (str): the session token of the current test run.
        test_id (number): the relevant test to be influenced by the operation.
    """
    PROPERTIES = [
        StringField(name="token", required=True, location="query"),
        NumberField(name="test_id", required=True, location="query")
    ]
Пример #11
0
class StartTestRunParamsModel(AbstractAPIModel):
    """Start a new run session.

    Args:
        tests (TestModel): the main test to build the run suite from.
        run_data (RunDataModel): the run data details of the current run.
    """
    PROPERTIES = [
        StringField(name="token", required=True),
        ModelField(name="tests", model=TestModel, required=True),
        ModelField(name="run_data", model=RunDataModel, required=True)
    ]
Пример #12
0
class LockResourcesParamsModel(AbstractAPIModel):
    """Lock the given described resources.

    Args:
        descriptors (list): list of ResourceDescriptorModel - the required
            resource to be locked.
    """
    PROPERTIES = [
        ArrayField(name="descriptors", items_type=ResourceDescriptorModel,
                   required=True),
        StringField(name="token", required=True)
    ]
Пример #13
0
class ResourceDescriptorModel(AbstractAPIModel):
    """Descriptor of a resource.

    Args:
        type (str): the type of the resource.
        properties (dict): django filter properties of the model.
    """
    TITLE = "Resource Descriptor"
    PROPERTIES = [
        StringField(name="type", required=True,
                    example="resources.models.CalculatorData"),
        ModelField(name="properties", model=GenericModel, required=True)
    ]
Пример #14
0
class ShouldSkipResponse(AbstractResponse):
    """Returns if the test should be skip and the reason why."""
    PROPERTIES = [
        BoolField(name="should_skip", required=True),
        StringField(name="reason", required=True)
    ]
Пример #15
0
class FailureResponseModel(AbstractResponse):
    """Returns when an invalid request is received."""
    PROPERTIES = [
        StringField(name="details", required=True),
        ModelField(name="errors", model=GenericModel)
    ]
Пример #16
0
class TokenModel(AbstractAPIModel):
    """Model that contains only a session token."""
    PROPERTIES = [StringField(name="token", required=True)]