gstepanov | 3ce37b8 | 2015-02-12 16:20:56 +0200 | [diff] [blame] | 1 | import json |
| 2 | import requests |
| 3 | |
| 4 | |
| 5 | def add_test(test_name, test_data, url): |
| 6 | if not url.endswith("/"): |
gstepanov | 8053b01 | 2015-02-16 17:25:27 +0200 | [diff] [blame] | 7 | url += '/api/tests/' + test_name |
gstepanov | 3ce37b8 | 2015-02-12 16:20:56 +0200 | [diff] [blame] | 8 | requests.post(url=url, data=json.dumps(test_data)) |
| 9 | |
| 10 | |
| 11 | def get_test(test_name, url): |
| 12 | if not url.endswith("/"): |
gstepanov | 8053b01 | 2015-02-16 17:25:27 +0200 | [diff] [blame] | 13 | url += '/api/tests/' + test_name |
gstepanov | 3ce37b8 | 2015-02-12 16:20:56 +0200 | [diff] [blame] | 14 | |
| 15 | result = requests.get(url=url) |
| 16 | |
| 17 | return json.loads(result.content) |
| 18 | |
| 19 | |
| 20 | def get_all_tests(url): |
gstepanov | 8053b01 | 2015-02-16 17:25:27 +0200 | [diff] [blame] | 21 | if not url.endswith('/'): |
| 22 | url += '/api/tests' |
| 23 | |
gstepanov | 3ce37b8 | 2015-02-12 16:20:56 +0200 | [diff] [blame] | 24 | result = requests.get(url=url) |
| 25 | return json.loads(result.content) |