summaryrefslogtreecommitdiffstats
path: root/testapi/testapi-client/testapiclient/client/deploy_results.py
blob: b0724b08f8f5ffe19f0934b297df207060b6b119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import json

from testapiclient.client import base
from testapiclient.utils import urlparse


class DeployResultsClient(base.Client):
    resource = 'deployresults'

    def __init__(self, **kwargs):
        super(DeployResultsClient, self).__init__(**kwargs)

    def create(self, testcase_req):
        return self.clientmanager.post(self.url, testcase_req)

    def get(self, **queries):
        if queries:
            return json.dumps(
                self.clientmanager.get(
                    urlparse.query_join(self.url, **queries))['deployresults'])
        else:
            return json.dumps(
                self.clientmanager.get(self.url)['deployresults'])

    def get_one(self, id):
        return json.dumps(
            self.clientmanager.get(
                urlparse.path_join(self.url, id)))