918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacion
Last change
on this file since 2f3d7f53 was
c1a046d,
checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago
|
#915 Extend REST API POST no payload tests to all remaining tests.
This patch extends tests for requests without any payload in the following REST
API POST functions:
- /clients
- /wol
- /shell/run
- /shell/output
- /session
- /poweroff
- /reboot
- /stop
- /refresh
- /hardware
- /software
|
-
Property mode set to
100644
|
File size:
669 bytes
|
Line | |
---|
1 | import requests |
---|
2 | import unittest |
---|
3 | |
---|
4 | class TestPostClientsMethods(unittest.TestCase): |
---|
5 | |
---|
6 | def setUp(self): |
---|
7 | self.url = 'http://localhost:8888/clients' |
---|
8 | self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} |
---|
9 | self.json = { 'clients' : [ '192.168.2.1', '192.168.2.2' ] } |
---|
10 | |
---|
11 | def test_post(self): |
---|
12 | returned = requests.post(self.url, headers=self.headers, json=self.json) |
---|
13 | self.assertEqual(returned.status_code, 200) |
---|
14 | |
---|
15 | def test_no_payload(self): |
---|
16 | returned = requests.post(self.url, headers=self.headers, json=None) |
---|
17 | self.assertEqual(returned.status_code, 400) |
---|
18 | |
---|
19 | if __name__ == '__main__': |
---|
20 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.