source: ogServer-Git/tests/units/test_0001_get_clients.py @ 8fa082d

Last change on this file since 8fa082d was c1c89e1, checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago

#915: Return 400 status code in POST methods when no payload is attached

If no payload is attached to method that requires a payload, then the API
returns a 400 status code (following RFC 7231) instead of the previous 404.

test_0001_get_clients.py is also modified to fit the new status code.

  • Property mode set to 100644
File size: 577 bytes
RevLine 
[1af2f4b]1import requests
2import unittest
3
4class TestGetClientsMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/clients'
[eae2385]8        self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
[1af2f4b]9
10    def test_get(self):
[eae2385]11        returned = requests.get(self.url, headers=self.headers)
[1af2f4b]12        self.assertEqual(returned.status_code, 200)
13
[741524f]14    def test_post_without_data(self):
[eae2385]15        returned = requests.post(self.url, headers=self.headers)
[c1c89e1]16        self.assertEqual(returned.status_code, 400)
[1af2f4b]17
18if __name__ == '__main__':
19    unittest.main()
Note: See TracBrowser for help on using the repository browser.