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

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

#1004 Add GET /images test

Fix incorrect error if json is missing.

  • Property mode set to 100644
File size: 813 bytes
Line 
1import requests
2import unittest
3
4class TestGetImagesMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/images'
8        self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
9        self.json = None
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_empty_payload(self):
16        returned = requests.get(self.url, headers=self.headers, json={})
17        self.assertEqual(returned.status_code, 400)
18
19    def test_malformed_payload(self):
20        returned = requests.get(self.url, headers=self.headers, json={ 'client': ['192.168.56.11'] })
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.