From 153e2abbf27684df82bdc379441577b2bcaaeb06 Mon Sep 17 00:00:00 2001 From: Jared Crawford Date: Mon, 4 Dec 2023 18:21:23 -0800 Subject: [PATCH] Fix plugins list endpoint --- lemur/plugins/lemur_vault_dest/plugin.py | 4 ++-- lemur/tests/test_plugins.py | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 lemur/tests/test_plugins.py diff --git a/lemur/plugins/lemur_vault_dest/plugin.py b/lemur/plugins/lemur_vault_dest/plugin.py index 044cb0b941..83abb027ff 100755 --- a/lemur/plugins/lemur_vault_dest/plugin.py +++ b/lemur/plugins/lemur_vault_dest/plugin.py @@ -39,7 +39,7 @@ class VaultSourcePlugin(SourcePlugin): "name": "vaultUrl", "type": "str", "required": True, - "validation": URL_RE, + "validation": URL_RE.pattern, "helpMessage": "Valid URL to Hashi Vault instance", }, { @@ -166,7 +166,7 @@ class VaultDestinationPlugin(DestinationPlugin): "name": "vaultUrl", "type": "str", "required": True, - "validation": URL_RE, + "validation": URL_RE.pattern, "helpMessage": "Valid URL to Hashi Vault instance", }, { diff --git a/lemur/tests/test_plugins.py b/lemur/tests/test_plugins.py new file mode 100644 index 0000000000..5a470a4aca --- /dev/null +++ b/lemur/tests/test_plugins.py @@ -0,0 +1,20 @@ +from lemur.plugins.views import * # noqa + + +from .vectors import ( + VALID_ADMIN_HEADER_TOKEN, +) + + +def test_plugins_list_get(client, app): + response = client.get(api.url_for(PluginsList), headers=VALID_ADMIN_HEADER_TOKEN) + assert response.status_code == 200 + + data = response.get_json() + + # Perform some assertions on data based on what you expect + assert 'items' in data + assert isinstance(data['items'], list) + + for item in data['items']: + assert 'title' in item