source: ogServer-Git/tests/units/test_0003_post_wol.py @ 6c91d14

Last change on this file since 6c91d14 was 55edb40, checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago

#915: Fix incorrect method and code in invalid GET requests

Some tests should perform GET requests however they incorrectly use POST.
Return codes for these tests have also been fixed.

  • Property mode set to 100644
File size: 698 bytes
RevLine 
[556aa6b]1import requests
2import unittest
3
4class TestPostWolMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/wol'
[eae2385]8        self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
[e397e79]9        self.json = { 'type' : 'broadcast', 'clients' : [ { 'addr' : '192.168.2.1',
10            'mac' : '00AABBCCDD01' } ] }
[556aa6b]11
12    def test_post(self):
[eae2385]13        returned = requests.post(self.url, headers=self.headers, json=self.json)
[556aa6b]14        self.assertEqual(returned.status_code, 200)
15
16    def test_get(self):
[55edb40]17        returned = requests.get(self.url, headers=self.headers)
18        self.assertEqual(returned.status_code, 405)
[556aa6b]19
20if __name__ == '__main__':
21    unittest.main()
Note: See TracBrowser for help on using the repository browser.