Пример #1
0
class TestAlgorithmSchemas(MockApiTest, ObjectTest):

    base_url = "/v1/algorithms/{algorithm.ext_id}/schemas"
    obj_key = "algorithmschema"
    obj_create_data = {"data": {"foo": "bar"}}
    obj_update_data = {"data": {"bar": "bam"}}

    fixtures = [
        {"auth_client": auth_client},
        {"organization": organization},
        {"user": user},
        {"project": lambda test, fixtures: project(test, fixtures, "example")},
        {"algorithm": lambda test, fixtures: algorithm(test, fixtures, "project")},
        {"algorithmschema": lambda test, fixtures: algorithmschema(test, fixtures)},
        {
            "algorithm_algorithmschema": lambda test, fixtures: algorithm_algorithmschema(
                test, fixtures, algorithm="algorithm", algoschema="algorithmschema"
            )
        },
        {
            "object_role": lambda test, fixtures: object_role(
                test, fixtures, "admin", "admin", "organization", "project"
            )
        },
    ]
class TestDatasetModelResults(MockApiTest, ObjectTest):

    obj_key = "dataset_model_result"
    obj_create_data = {"data": {"foo": "bar"}, "name": "test"}
    obj_update_data = {"data": {"bar": "bam"}, "name": "bar"}

    fixtures = [
        {
            "auth_client": auth_client
        },
        {
            "organization": organization
        },
        {
            "user": user
        },
        {
            "project":
            lambda test, fixtures: project(test, fixtures, "example")
        },
        {
            "algorithm":
            lambda test, fixtures: algorithm(test, fixtures, "project")
        },
        {
            "dataset":
            lambda test, fixtures: dataset(test, fixtures, name="foo/bar")
        },
        {
            "model": model
        },
        {
            "dataset_model_result": dataset_model_result
        },
        {
            "object_role":
            lambda test, fixtures: object_role(
                test, fixtures, "admin", "admin", "organization", "project")
        },
    ]

    @property
    def url(self):
        model = self.model
        return "/v1/models/{}/datasetresults".format(model.ext_id)

    @property
    def list_url(self):
        ds = self.dataset
        model = self.model
        return "/v1/datasets/{}/models/{}/results".format(
            ds.ext_id, model.ext_id)

    @property
    def create_url(self):
        return self.list_url
Пример #3
0
class TestAlgorithmResults(MockApiTest, ObjectTest):

    base_url = "/v1/algorithms/{algorithm.ext_id}/results"
    obj_key = "algorithm_result"
    obj_create_data = {"data": {"foo": "bars"}, "name": "another test"}
    obj_update_data = {"data": {"bar": "bam"}, "name": "bar"}

    fixtures = [
        {
            "auth_client": auth_client
        },
        {
            "organization": organization
        },
        {
            "user": user
        },
        {
            "project":
            lambda test, fixtures: project(test, fixtures, "example")
        },
        {
            "algorithm":
            lambda test, fixtures: algorithm(test, fixtures, "project")
        },
        {
            "dataset":
            lambda test, fixtures: dataset(test, fixtures, name="foo/bar")
        },
        {
            "model": model
        },
        {
            "algorithm_result": algorithm_result
        },
        {
            "object_role":
            lambda test, fixtures: object_role(
                test, fixtures, "admin", "admin", "organization", "project")
        },
    ]
Пример #4
0
class TestAlgorithmModels(MockApiTest, ObjectTest):

    base_url = "/v1/models"
    obj_key = "model"
    obj_create_data = {"data": {"foo": "bar"}}
    obj_update_data = {"data": {"bar": "bam"}}

    @property
    def list_url(self):
        return "/v1/algorithms/{}/models".format(self.algorithm.ext_id)

    @property
    def create_url(self):
        return "/v1/datasets/{}/algorithms/{}/models".format(
            self.dataset.ext_id, self.algorithm.ext_id
        )

    fixtures = [
        {"auth_client": auth_client},
        {"organization": organization},
        {"user": user},
        {"project": lambda test, fixtures: project(test, fixtures, "example")},
        {"algorithm": lambda test, fixtures: algorithm(test, fixtures, "project")},
        {"dataset": lambda test, fixtures: dataset(test, fixtures, name="foo/bar")},
        {"model": model},
        {"model_result": model_result},
        {
            "object_role": lambda test, fixtures: object_role(
                test, fixtures, "admin", "admin", "organization", "project"
            )
        },
    ]

    def _create(self, data):
        ds = self.dataset
        av = self.algorithm
        return self.app.post(
            "/v1/datasets/{}/algorithms/{}/models".format(ds.ext_id, av.ext_id),
            headers={"Authorization": "bearer test"},
            json=data,
        )
Пример #5
0
class Tests(MockApiTest, ObjectTest):

    base_url = "/v1/algorithms"
    obj_key = "algorithm"
    obj_create_data = {"data": {"foo": "bar"}, "name": "test"}
    obj_update_data = {"data": {"bar": "bam"}, "name": "foo"}

    @property
    def list_url(self):
        return "/v1/projects/{}/algorithms".format(self.project.ext_id)

    @property
    def create_url(self):
        return self.list_url

    fixtures = [
        {
            "auth_client": auth_client
        },
        {
            "organization": organization
        },
        {
            "user": user
        },
        {
            "project":
            lambda test, fixtures: project(test, fixtures, "example")
        },
        {
            "algorithm":
            lambda test, fixtures: algorithm(test, fixtures, "project")
        },
        {
            "object_role":
            lambda test, fixtures: object_role(
                test, fixtures, "admin", "admin", "organization", "project")
        },
    ]