diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-28 20:17:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 20:17:46 +0200 |
commit | 4b05357eb847c6f6cb571a74208133d4a2e3d020 (patch) | |
tree | c033e098e510e06b6fe76296493a9b5a7fbc370e /smoketest/scripts | |
parent | f04776073d1e46cfd022e6daf8742e0968d50e4b (diff) | |
parent | cbb61faed494381b0c655d811920413b31fd294d (diff) | |
download | vyos-1x-4b05357eb847c6f6cb571a74208133d4a2e3d020.tar.gz vyos-1x-4b05357eb847c6f6cb571a74208133d4a2e3d020.zip |
Merge pull request #3529 from HollyGurza/T5786
T5786: Add set/show system image to /image endpoint
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-x | smoketest/scripts/cli/test_service_https.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index f2a64627f..8a6386e4f 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -412,6 +412,47 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): self.assertEqual(r.status_code, 200) @ignore_warning(InsecureRequestWarning) + def test_api_image(self): + address = '127.0.0.1' + key = 'VyOS-key' + url = f'https://{address}/image' + headers = {} + + self.cli_set(base_path + ['api', 'keys', 'id', 'key-01', 'key', key]) + self.cli_commit() + + payload = { + 'data': '{"op": "add"}', + 'key': f'{key}', + } + r = request('POST', url, verify=False, headers=headers, data=payload) + self.assertEqual(r.status_code, 400) + self.assertIn('Missing required field "url"', r.json().get('error')) + + payload = { + 'data': '{"op": "delete"}', + 'key': f'{key}', + } + r = request('POST', url, verify=False, headers=headers, data=payload) + self.assertEqual(r.status_code, 400) + self.assertIn('Missing required field "name"', r.json().get('error')) + + payload = { + 'data': '{"op": "set_default"}', + 'key': f'{key}', + } + r = request('POST', url, verify=False, headers=headers, data=payload) + self.assertEqual(r.status_code, 400) + self.assertIn('Missing required field "name"', r.json().get('error')) + + payload = { + 'data': '{"op": "show"}', + 'key': f'{key}', + } + r = request('POST', url, verify=False, headers=headers, data=payload) + self.assertEqual(r.status_code, 200) + + @ignore_warning(InsecureRequestWarning) def test_api_config_file_load_http(self): # Test load config from HTTP URL address = '127.0.0.1' |