source: ogServer-Git/tests/units/test_0020_post_run_schedule.py @ 1d451ac

Last change on this file since 1d451ac was 1d451ac, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

#915 Fix several test errors

Test 0006: add json to GET /session and update expected return code.
Test 0012: add json to GET /software and update expected return code (200),
in this case json fields are integer, not string.
Test 0020: remove it, /image/create/incremental does not exist anymore.
Test 0021: same as before for /image/restore/basic
Test 0022: same as before for /image/restore/incremental
Test 0023: rename to test_0020.

  • Property mode set to 100644
File size: 984 bytes
RevLine 
[2bc2490]1import requests
2import unittest
3
4class TestPostRunScheduleMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/run/schedule'
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
[abd2b91]19    def test_malformed_payload(self):
20        returned = requests.post(self.url, headers=self.headers, json={})
21        self.assertEqual(returned.status_code, 400)
22
[2bc2490]23    def test_get(self):
24        returned = requests.get(self.url, headers=self.headers)
25        self.assertEqual(returned.status_code, 405)
26
27if __name__ == '__main__':
28    unittest.main()
Note: See TracBrowser for help on using the repository browser.