Last change
on this file since 3de93a9 was
880cc90,
checked in by OpenGnSys Support Team <soporte-og@…>, 6 years ago
|
#915 Improve test output using unittest discover
- Call the tests with python module unittest. In particular, the
discover function.
- Rename tests files to meet the default requirements of discover
function.
|
-
Property mode set to
100644
|
File size:
660 bytes
|
Rev | Line | |
---|
[496f5eb] | 1 | import requests |
---|
| 2 | import unittest |
---|
| 3 | |
---|
| 4 | class TestPostShellOutputMethods(unittest.TestCase): |
---|
| 5 | |
---|
| 6 | def setUp(self): |
---|
| 7 | self.url = 'http://localhost:8888/shell/output' |
---|
[eae2385] | 8 | self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} |
---|
[496f5eb] | 9 | self.json = { 'clients' : [ '192.168.2.1', '192.168.2.2' ] } |
---|
[eae2385] | 10 | |
---|
[496f5eb] | 11 | def test_post(self): |
---|
[eae2385] | 12 | returned = requests.post(self.url, headers=self.headers, json=self.json) |
---|
[496f5eb] | 13 | self.assertEqual(returned.status_code, 200) |
---|
| 14 | |
---|
| 15 | def test_get(self): |
---|
[eae2385] | 16 | returned = requests.post(self.url, headers=self.headers) |
---|
[496f5eb] | 17 | self.assertEqual(returned.status_code, 404) |
---|
| 18 | |
---|
| 19 | if __name__ == '__main__': |
---|
| 20 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.