source: ogServer-Git/tests/units/test_0012_post_software.py @ 1cdbc5f

Last change on this file since 1cdbc5f was 65cc7c1, 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: 889 bytes
RevLine 
[9c7954b]1import requests
2import unittest
3
4class TestPostSoftwareMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/software'
8        self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
[64b4705]9        self.json = { 'clients' : [ '192.168.2.1', '192.168.2.2' ],
10                      'disk' : '0',
11                      'partition' : '1' }
[9c7954b]12
13    def test_post(self):
14        returned = requests.post(self.url, headers=self.headers, json=self.json)
15        self.assertEqual(returned.status_code, 200)
16
[65cc7c1]17    def test_no_payload(self):
18        returned = requests.post(self.url, headers=self.headers, json=None)
19        self.assertEqual(returned.status_code, 400)
20
[9c7954b]21    def test_get(self):
22        returned = requests.get(self.url, headers=self.headers)
23        self.assertEqual(returned.status_code, 405)
24
25if __name__ == '__main__':
26    unittest.main()
Note: See TracBrowser for help on using the repository browser.