Exemple #1
0
 def test_jobgroup_schema(self):
     response = self.client.get("/api/v1/jobgroups/schema")
     self.assert_ok(response)
     schema = JobGroup.to_schema()
     schema["user"] = "******" % config.get("max_username_length")
     del schema["user_id"]
     schema["main_jobtype"] = \
         "VARCHAR(%s)" % config.get("job_type_max_name_length")
     del schema["main_jobtype_id"]
     self.assertEqual(response.json, schema)
def schema():
    """
    Returns the basic schema of :class:`.JobGroup`

    .. http:get:: /api/v1/jobgroups/schema HTTP/1.1

        **Request**

        .. sourcecode:: http

            GET /api/v1/jobgroups/schema HTTP/1.1
            Accept: application/json

        **Response**

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "main_jobtype": "VARCHAR(64)",
                "title": "VARCHAR(255)",
                "user": "******",
                "id": "INTEGER"
            }

    :statuscode 200: no error
    """
    schema_dict = JobGroup.to_schema()

    # In the database, we are storing the user by id, but over the wire, we are
    # using the username to identify the user instead.
    schema_dict["user"] = "******" % config.get("max_username_length")
    del schema_dict["user_id"]
    schema_dict["main_jobtype"] = \
        "VARCHAR(%s)" % config.get("job_type_max_name_length")
    del schema_dict["main_jobtype_id"]
    return jsonify(schema_dict), OK
Exemple #3
0
def schema():
    """
    Returns the basic schema of :class:`.JobGroup`

    .. http:get:: /api/v1/jobgroups/schema HTTP/1.1

        **Request**

        .. sourcecode:: http

            GET /api/v1/jobgroups/schema HTTP/1.1
            Accept: application/json

        **Response**

        .. sourcecode:: http

            HTTP/1.1 200 OK
            Content-Type: application/json

            {
                "main_jobtype": "VARCHAR(64)",
                "title": "VARCHAR(255)",
                "user": "******",
                "id": "INTEGER"
            }

    :statuscode 200: no error
    """
    schema_dict = JobGroup.to_schema()

    # In the database, we are storing the user by id, but over the wire, we are
    # using the username to identify the user instead.
    schema_dict["user"] = "******" % config.get("max_username_length")
    del schema_dict["user_id"]
    schema_dict["main_jobtype"] = "VARCHAR(%s)" % config.get("job_type_max_name_length")
    del schema_dict["main_jobtype_id"]
    return jsonify(schema_dict), OK