Exemple #1
0
 class _endpoint_item:
     endpoint_uid = doc.String()
     name = doc.String()
     status = doc.String()
     enable = doc.Boolean()
     last_run = doc.Integer(
         description="Timestamp in milliseconds, 0 if not run yet")
     tests = doc.List(doc.String())
     test_refs = doc.List(doc.String())
     endpoint_uid = doc.String()
Exemple #2
0
        class _script_file_list:
            class _file_list:
                label = doc.String(description='The file name')
                type = doc.String(
                    description='The file type: file or directory')
                children = doc.List(doc.JsonBody())

            test_scripts = doc.List(doc.Object(_file_list),
                                    description='The test script file list')
            test_libraries = doc.List(
                doc.Object(_file_list),
                description='The python script file list')
Exemple #3
0
 class task(organization_team):
     test_suite = doc.String(required=True,
                             description='The test suite name')
     path = doc.String(required=True,
                       description='The test suite\'s path name')
     endpoint_list = doc.List(
         doc.String(description='The endpoints to run the test'))
     priority = doc.Integer(
         description=
         'The priority of the task(larger number means higher importance)')
     parallelization = doc.Boolean()  #default=False)
     variables = doc.List(doc.String())
     test_cases = doc.List(doc.String())
     upload_dir = doc.String(
         description='The directory id of the upload files')
Exemple #4
0
        class _user_list:
            class _user:
                label = doc.String(description='The user name')
                email = doc.String(description='The user email')
                value = doc.String(description='The user ID')

            users = doc.List(_user)
Exemple #5
0
        class _doc_history:
            class __doc_history:
                title = doc.String()
                revision = doc.String()
                description = doc.String()

            history = doc.List(doc.Object(__doc_history))
Exemple #6
0
 class _test_suite:
     id = doc.String()
     test_suite = doc.String()
     path = doc.String()
     test_cases = doc.List(doc.String())
     variables = doc.JsonBody()
     author = doc.String()
Exemple #7
0
 class endpoint(organization_team):
     endpoint_uid = doc.String(name='uid',
                               description='The endpoint\'s uid')
     tests = doc.List(doc.String(),
                      description='The tests that the endpoint supports')
     endpoint_name = doc.String()
     enable = doc.Boolean()  #default=False)
Exemple #8
0
        class _doc_pictures:
            class __doc_pictures:
                name = doc.String()
                data = doc.String()
                type = doc.String()
                size = doc.Integer()

            file_list = doc.List(doc.Object(__doc_pictures))
Exemple #9
0
class CommunityView(HTTPMethodView):
    def __init__(self):
        super().__init__()

    async def options(self, _):
        return response.text('')

    @doc.summary(
        "Retrieve a list of all communities. Optional 'limit' query parameter will limit the number of returned communities."
    )
    @doc.produces(doc.List(Community))
    async def get(self, request):
        with db_session:
            rval = []
            query = Community.select()
            if 'limit' in request.args:
                query = query.limit(int(request.args['limit'][0]))
            for c in query:
                rval.append({
                    'id': c.id,
                    'slug': c.slug,
                    'name': c.name if c.name is not "" else c.slug,
                    'icon': c.icon
                })
            return response.json({'communities': rval})

    @doc.summary("Create a new community.")
    @validate_json(schema_file=os.path.join(os.path.dirname(__file__), "..",
                                            "..", "schema",
                                            "community_detail_v1.json"))
    async def post(self, request):
        if "id" in request.json:
            raise exceptions.SanicException(
                "ID should not be specified with POST", status_code=409)
        with db_session:
            if Community.exists(slug=request.json['slug']):
                raise exceptions.SanicException("Slug already exists",
                                                status_code=409)
            c = Community(slug=request.json['slug'],
                          name=request.json.get('name', ""),
                          description=request.json.get('description', ""),
                          icon=request.json.get('icon', ""),
                          owner=request.json['owner'])
            for tag_name in request.json.get('tags', []):
                try:
                    tag = Tag[tag_name]
                except ObjectNotFound:
                    tag = Tag(tag=tag_name)
                c.tags.add(tag)
            commit()
            return response.json(c.to_dict(),
                                 status=201,
                                 headers={
                                     "Location":
                                     request.app.url_for(
                                         "communities_v1.CommunityDetailView",
                                         id=c.id)
                                 })
Exemple #10
0
        class _user_list:
            class _user_info:
                user_id = doc.String(description='User identifier')
                email = doc.String()
                username = doc.String()
                introduction = doc.String()
                region = doc.String()

            user = doc.List(_user_info)
Exemple #11
0
        class _task_resource_file_list:
            class _file_list:
                label = doc.String(description='The file name')
                type = doc.String(
                    description='The file type: file or directory')
                children = doc.List(doc.JsonBody())

            files = doc.List(doc.Object(_file_list),
                             description='The test script file list')
Exemple #12
0
        class _team_list:
            class _team:
                label = doc.String(description='The team name')
                owner = doc.String(description='The team owner\'s name')
                owner_email = doc.String(description='The team owner\'s email')
                organization_id = doc.String(
                    description=
                    'The ID of the organization that the team belongs to')
                value = doc.String(description='The team ID')

            teams = doc.List(_team)
Exemple #13
0
 class _package_summary:
     name = doc.String()
     summary = doc.String()
     description = doc.String()
     stars = doc.Integer()
     download_times = doc.Integer()
     package_type = doc.String()
     versions = doc.List(doc.String())
     upload_date = doc.Integer(
         description=
         'The upload date in form of timestamp from the epoch in milliseconds'
     )
Exemple #14
0
    class SuccessResp:
        code = 200
        description = "On success request"

        class model:
            lock_id = doc.String("lock id")
            lock_type = doc.String("Lock type")
            ip = doc.Integer("ip")
            lock_date = doc.String("Ip's lock date")
            unlock_date = doc.String("Ip's unlock date")
            lock_by_user_id = doc.String("Locked by who")

        model = doc.List(model)
Exemple #15
0
        class _organization_list:
            class _organization:
                label = doc.String(description='The organization name')
                owner = doc.String(
                    description='The organization owner\'s name')
                owner_email = doc.String(
                    description='The organization owner\'s email')
                personal = doc.Boolean(
                    description='The organization is of person'
                )  #, default=False)
                value = doc.String(description='The organization ID')

            organizations = doc.List(_organization)
Exemple #16
0
        class _task_stat_list:
            class _task_stat_of_a_day:
                succeeded = doc.Integer(
                    description='The count of tasks ran successfully in the day'
                )
                failed = doc.Integer(
                    description='The count of tasks failed to run in the day')
                running = doc.Integer(
                    description='The count of tasks running right now')
                waiting = doc.Integer(
                    description='The count of tasks waiting right now')

            stats = doc.List(_task_stat_of_a_day)
Exemple #17
0
 class _test_report_summary:
     id = doc.String(description='The task id')
     test_id = doc.String(
         description='The test id of the associated task')
     test_suite = doc.String(description='The test suite name')
     testcases = doc.List(doc.String())
     comment = doc.String()
     priority = doc.Integer(description='The priority of the task')
     run_date = doc.Integer(
         description=
         'The date in form of timestamp from the epoch in milliseconds'
     )
     tester = doc.String()
     status = doc.String()
Exemple #18
0
            class _organization_team:
                class _team:
                    label = doc.String(description='The team name')
                    owner = doc.String(description='The team owner\'s name')
                    owner_email = doc.String(
                        description='The team owner\'s email')
                    value = doc.String(description='The team ID')

                label = doc.String(description='The organization name')
                owner = doc.String(
                    description='The organization owner\'s name')
                owner_email = doc.String(
                    description='The organization owner\'s email')
                value = doc.String(description='The organization ID')
                children = doc.List(doc.Object(_team))
Exemple #19
0
            class _queuing_tasks:
                class _queuing_task:
                    endpoint = doc.String(description="The endpoint name")
                    endpoint_uid = doc.String(description="The endpoint uid")
                    priority = doc.Integer()
                    task = doc.String(description="The test name")
                    task_id = doc.String(description="The task id")
                    status = doc.String()

                endpoint_uid = doc.String(description="The endpoint uid")
                endpoint = doc.String(description="The endpoint name")
                priority = doc.Integer()
                waiting = doc.Integer()
                status = doc.String()
                tasks = doc.List(doc.Object(_queuing_task))
Exemple #20
0
        class _endpoint_list:
            class _endpoint_item:
                endpoint_uid = doc.String()
                name = doc.String()
                status = doc.String()
                enable = doc.Boolean()
                last_run = doc.Integer(
                    description="Timestamp in milliseconds, 0 if not run yet")
                tests = doc.List(doc.String())
                test_refs = doc.List(doc.String())
                endpoint_uid = doc.String()

            endpoints = doc.List(
                doc.Object(_endpoint_item),
                description='endpoints of the current queried page')
            total = doc.Integer(
                description='total number of the queried the endpoints')