blob: 7bff6c853c3ff124a5b22b0ba512d31055ff020c [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("/"):
7 url += '/' + test_name
8
9 requests.post(url=url, data=json.dumps(test_data))
10
11
12def get_test(test_name, url):
13 if not url.endswith("/"):
14 url += '/' + test_name
15
16 result = requests.get(url=url)
17
18 return json.loads(result.content)
19
20
21def get_all_tests(url):
22 result = requests.get(url=url)
23 return json.loads(result.content)
24
25
26if __name__ == '__main__':
27 url = "http://0.0.0.0:5000/api/tests"
28 test = get_test("GA", url=url)
29 print test
30
31 tests = get_all_tests(url=url)
32 print tests
33
34 # test["type"] = "some build name"
35 # add_test("bla_bla", [test], url=url)
36
37 tests = get_all_tests(url=url)
38 print len(tests)