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

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

#915 Add GET /oglive/test REST API function

This function returns the installed and available ogLiveS in the server
to be booted from.

Request:
GET /oglive/list
NO BODY

Response
200 OK
{

"oglive": [

{

"distribution": "bionic",
"kernel": "5.4.0-40-generic",
"architecture": "amd64",
"revision": "r20200629",
"directory": "ogLive-5.4.0-r20200629",
"iso": "ogLive-bionic-5.4.0-40-generic-amd64-r20200629.85eceaf.iso"

},
{

"distribution": "bionic",
"kernel": "5.0.0-27-generic",
"architecture": "amd64",
"revision": "r20190830",
"directory": "ogLive-5.0.0-r20190830",
"iso": "ogLive-bionic-5.0.0-27-generic-amd64-r20190830.7208cc9.iso"

}

],
"default": 0

}

This commit also adds tests for GET /oglive/test.

  • Property mode set to 100644
File size: 571 bytes
Line 
1import requests
2import unittest
3
4class TestGetOgliveListMethods(unittest.TestCase):
5
6    def setUp(self):
7        self.url = 'http://localhost:8888/oglive/list'
8        self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
9
10    def test_get(self):
11        returned = requests.get(self.url, headers=self.headers)
12        self.assertEqual(returned.status_code, 200)
13
14    def test_post(self):
15        returned = requests.post(self.url, headers=self.headers)
16        self.assertEqual(returned.status_code, 405)
17
18if __name__ == '__main__':
19    unittest.main()
Note: See TracBrowser for help on using the repository browser.