summaryrefslogtreecommitdiffstats
path: root/functest/api/resources/v1/tiers.py
diff options
context:
space:
mode:
authorLinda Wang <wangwulin@huawei.com>2017-09-12 07:37:19 +0000
committerMorgan Richomme <morgan.richomme@orange.com>2017-09-19 14:46:07 +0000
commit7683b977ee4b1c88b0876b4a18a1ae76aad6f8ab (patch)
treeb067d6b566d00b7220bc8244ce98082d0f276e73 /functest/api/resources/v1/tiers.py
parent124a658f45154235af466d70cb8364ef4ab79a36 (diff)
Add swagger support for Rest API
JIRA: FUNCTEST-854 Change-Id: Ic010604d3ba0cc46092cf2a1ae8bb41afa73c920 Signed-off-by: Linda Wang <wangwulin@huawei.com> (cherry picked from commit b621b6b4b70299a60ad3e26ed6b04450f84b603e)
Diffstat (limited to 'functest/api/resources/v1/tiers.py')
-rw-r--r--functest/api/resources/v1/tiers.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/functest/api/resources/v1/tiers.py b/functest/api/resources/v1/tiers.py
index b58ab205e..523df130e 100644
--- a/functest/api/resources/v1/tiers.py
+++ b/functest/api/resources/v1/tiers.py
@@ -11,9 +11,11 @@
Resources to handle tier related requests
"""
+import pkg_resources
import re
from flask import jsonify
+from flasgger.utils import swag_from
from functest.api.base import ApiResource
from functest.api.common import api_utils
@@ -23,6 +25,8 @@ from functest.cli.commands.cli_tier import Tier
class V1Tiers(ApiResource):
""" V1Tiers Resource class """
+ @swag_from(pkg_resources.resource_filename(
+ 'functest', 'api/swagger/tiers.yaml'))
def get(self):
# pylint: disable=no-self-use
""" GET all tiers """
@@ -43,6 +47,8 @@ class V1Tiers(ApiResource):
class V1Tier(ApiResource):
""" V1Tier Resource class """
+ @swag_from(pkg_resources.resource_filename(
+ 'functest', 'api/swagger/tier.yaml'))
def get(self, tier_name): # pylint: disable=no-self-use
""" GET the info of one tier """
tier_info = Tier().show(tier_name)
@@ -62,6 +68,8 @@ class V1Tier(ApiResource):
class V1TestcasesinTier(ApiResource):
""" V1TestcasesinTier Resource class """
+ @swag_from(pkg_resources.resource_filename(
+ 'functest', 'api/swagger/testcases_in_tier.yaml'))
def get(self, tier_name): # pylint: disable=no-self-use
""" GET all testcases within given tier """
tier_info = Tier().show(tier_name)