blob: 619c13bba3932345350f97d696a5c1c667ce6565 [file] [log] [blame]
gstepanov3ce37b82015-02-12 16:20:56 +02001import json
2import requests
3
4
5def add_test(test_name, test_data, url):
6 if not url.endswith("/"):
gstepanov8053b012015-02-16 17:25:27 +02007 url += '/api/tests/' + test_name
gstepanov3ce37b82015-02-12 16:20:56 +02008
gstepanov8053b012015-02-16 17:25:27 +02009 import pdb
10 pdb.set_trace()
gstepanov3ce37b82015-02-12 16:20:56 +020011 requests.post(url=url, data=json.dumps(test_data))
12
13
14def get_test(test_name, url):
15 if not url.endswith("/"):
gstepanov8053b012015-02-16 17:25:27 +020016 url += '/api/tests/' + test_name
gstepanov3ce37b82015-02-12 16:20:56 +020017
18 result = requests.get(url=url)
19
20 return json.loads(result.content)
21
22
23def get_all_tests(url):
gstepanov8053b012015-02-16 17:25:27 +020024 if not url.endswith('/'):
25 url += '/api/tests'
26
gstepanov3ce37b82015-02-12 16:20:56 +020027 result = requests.get(url=url)
28 return json.loads(result.content)
29
30
31if __name__ == '__main__':
32 url = "http://0.0.0.0:5000/api/tests"
33 test = get_test("GA", url=url)
34 print test
35
36 tests = get_all_tests(url=url)
37 print tests
38
39 # test["type"] = "some build name"
40 # add_test("bla_bla", [test], url=url)
41
42 tests = get_all_tests(url=url)
koder aka kdanilov6e2ae792015-03-04 18:02:24 -080043 print len(tests)