From 143621114e715eec996a2368011d7f559e89fa07 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 7 Apr 2022 14:57:44 -0500 Subject: smoketest: http: bind http api to unix domain socket --- smoketest/scripts/cli/test_service_https.py | 1 + 1 file changed, 1 insertion(+) (limited to 'smoketest/scripts') diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index 2901cafa8..921344255 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -106,6 +106,7 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): port = '443' name = 'localhost' + self.cli_set(base_path + ['api', 'socket']) key = 'MySuperSecretVyOS' self.cli_set(base_path + ['api', 'keys', 'id', 'key-01', 'key', key]) -- cgit v1.2.3 From 84bfac85a711d22d97e1ee39a5233738e14a7750 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 7 Apr 2022 15:04:55 -0500 Subject: smoketest: http: add check for missing key --- smoketest/scripts/cli/test_service_https.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'smoketest/scripts') diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index 921344255..9413d22d1 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -133,5 +133,10 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): # Must get HTTP code 401 on invalid key (Unauthorized) self.assertEqual(r.status_code, 401) + payload_no_key = {'data': '{"op": "showConfig", "path": []}'} + r = request('POST', url, verify=False, headers=headers, data=payload_no_key) + # Must get HTTP code 401 on missing key (Unauthorized) + self.assertEqual(r.status_code, 401) + if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3