blob: fc9bd051ab2091b5ce43961b9910dfea42b05462 [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 requests.post(url=url, data=json.dumps(test_data))
9
10
11def get_test(test_name, url):
12 if not url.endswith("/"):
gstepanov8053b012015-02-16 17:25:27 +020013 url += '/api/tests/' + test_name
gstepanov3ce37b82015-02-12 16:20:56 +020014
15 result = requests.get(url=url)
16
17 return json.loads(result.content)
18
19
20def get_all_tests(url):
gstepanov8053b012015-02-16 17:25:27 +020021 if not url.endswith('/'):
22 url += '/api/tests'
23
gstepanov3ce37b82015-02-12 16:20:56 +020024 result = requests.get(url=url)
25 return json.loads(result.content)