source: ogServer-Git/tests/units/test_0027_get_hardware.py

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

Fix GET /hardware test url

  • Property mode set to 100644
File size: 822 bytes
Line 
1import requests
2import unittest
3
4class TestGetHardwareMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/hardware'
8        self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
9        self.json = { 'client' : ['192.168.56.11'] }
10
11    def test_get(self):
12        returned = requests.get(self.url, headers=self.headers, json=self.json)
13        self.assertEqual(returned.status_code, 200)
14
15    def test_get_without_data(self):
16        returned = requests.get(self.url, headers=self.headers, json= None)
17        self.assertEqual(returned.status_code, 400)
18
19    def test_malformed_payload(self):
20        returned = requests.get(self.url, headers=self.headers, json={})
21        self.assertEqual(returned.status_code, 400)
22
23
24if __name__ == '__main__':
25    unittest.main()
Note: See TracBrowser for help on using the repository browser.