diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-04-08 07:10:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 07:10:31 +0200 |
commit | 5399a8f75b5a44dd789101844d52b5f9c4e301f9 (patch) | |
tree | e943d2dbdf44e454f7d0d91d3a7c7a0f7f522b67 /smoketest/scripts/cli | |
parent | 44c67e54ef6ecdf4d7b62e765ccfa4e724c14316 (diff) | |
parent | 84bfac85a711d22d97e1ee39a5233738e14a7750 (diff) | |
download | vyos-1x-5399a8f75b5a44dd789101844d52b5f9c4e301f9.tar.gz vyos-1x-5399a8f75b5a44dd789101844d52b5f9c4e301f9.zip |
Merge pull request #1277 from jestabro/api-smoketest
T4347: Bug fix and extension of HTTP smoketest
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-x | smoketest/scripts/cli/test_service_https.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index 2901cafa8..9413d22d1 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]) @@ -132,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) |