Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:00

0001 # Description: Unit tests for the System API methods
0002 import unittest
0003 
0004 from pandaserver.api.v1.http_client import HttpClient, api_url_ssl
0005 
0006 
0007 class TestSystemAPI(unittest.TestCase):
0008     def setUp(self):
0009         self.http_client = HttpClient()
0010 
0011     def test_get_attributes(self):
0012         url = f"{api_url_ssl}/system/get_attributes"
0013         print(f"Testing URL: {url}")
0014         data = {"test_key_string": "test_value", "test_key_int": 12345}
0015         status, output = self.http_client.get(url, data)
0016         print(output)
0017         output["status"] = status
0018 
0019         expected_response = {"status": 0, "success": True}
0020         self.assertEqual(output, expected_response)
0021 
0022     def test_get_user_attributes(self):
0023         url = f"{api_url_ssl}/system/get_user_attributes"
0024         print(f"Testing URL: {url}")
0025         data = {}
0026         status, output = self.http_client.get(url, data)
0027         print(output)
0028         output["status"] = status
0029 
0030         expected_response = {"status": 0, "success": True}
0031         self.assertEqual(output, expected_response)
0032 
0033     def test_get_voms_attributes(self):
0034         url = f"{api_url_ssl}/system/get_voms_attributes"
0035         print(f"Testing URL: {url}")
0036         data = {}
0037         status, output = self.http_client.get(url, data)
0038         print(output)
0039         output["status"] = status
0040 
0041         expected_response = {"status": 0, "success": True}
0042         self.assertEqual(output, expected_response)
0043 
0044     def test_is_alive(self):
0045         url = f"{api_url_ssl}/system/is_alive"
0046         print(f"Testing URL: {url}")
0047         data = {}
0048         status, output = self.http_client.get(url, data)
0049         print(output)
0050         output["status"] = status
0051 
0052         expected_response = {"status": 0, "success": True}
0053         self.assertEqual(output, expected_response)
0054 
0055 
0056 # Run tests
0057 if __name__ == "__main__":
0058     unittest.main()