diff --git a/.coveragerc b/.coveragerc index 6d5c35a0e6..e57980816f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -31,4 +31,4 @@ relative_files = true source = tests source_pkgs = - awx_plugins.credentials.x.api + awx_plugins diff --git a/pyproject.toml b/pyproject.toml index 17db907d3a..99cc6ec206 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,13 @@ dependencies = [ # runtime deps # https://packaging.python.org/en/latest/guide # GUIDANCE: only add things that this project imports directly # GUIDANCE: only set lower version bounds # "awx_plugins.base_interface.api", # keep `__init__.py` empty + "azure-identity", # credentials.azure_kv + "azure-keyvault", # credentials.azure_kv + "boto3", # credentials.awx_secretsmanager + "msrestazure", # credentials.azure_kv + "python-dsv-sdk >= 1.0.4", # credentials.thycotic_dsv + "python-tss-sdk >= 1.2.1", # credentials.thycotic_tss + "requests", # credentials.aim, credentials.centrify_vault, credentials.conjur, credentials.hashivault ] classifiers = [ # Allowlist: https://pypi.org/classifiers/ "Development Status :: 1 - Planning", diff --git a/src/awx_plugins/credentials/x/api.py b/src/awx_plugins/credentials/x/api.py deleted file mode 100644 index 8139e413fb..0000000000 --- a/src/awx_plugins/credentials/x/api.py +++ /dev/null @@ -1,5 +0,0 @@ -"""Plugin entry point module.""" - - -class XPlugin: # pylint: disable=too-few-public-methods - """Plugin entry point.""" diff --git a/tests/importable_test.py b/tests/importable_test.py index 9caa9b56c1..71f72c903d 100644 --- a/tests/importable_test.py +++ b/tests/importable_test.py @@ -5,22 +5,53 @@ import pytest +EXPECTED_ENTRY_POINTS: list[tuple[str, str, str]] = [ + ('awx_plugins.credentials', 'aim', 'aim', 'aim_plugin'), + ('awx_plugins.credentials', 'conjur', 'conjur', 'conjur_plugin'), + ('awx_plugins.credentials', 'hashivault_kv', 'hashivault', 'hashivault_kv_plugin'), + ('awx_plugins.credentials', 'hashivault_ssh', 'hashivault', 'hashivault_ssh_plugin'), + ('awx_plugins.credentials', 'azure_kv', 'azure_kv', 'azure_keyvault_plugin'), + ('awx_plugins.credentials', 'centrify_vault_kv', 'centrify_vault', 'centrify_plugin'), + ('awx_plugins.credentials', 'thycotic_dsv', 'dsv', 'dsv_plugin'), + ('awx_plugins.credentials', 'thycotic_tss', 'tss', 'tss_plugin'), + ('awx_plugins.credentials', 'aws_secretsmanager_credential', 'aws_secretsmanager', 'aws_secretmanager_plugin'), +] + + @pytest.mark.parametrize( - 'entry_points_group', ( - 'awx.credential_plugins', - 'awx_plugins.credentials', + 'entry_points_group', + 'expected_entry_point_name', + 'expected_entry_point_module', + 'expected_entry_point_func', ), + EXPECTED_ENTRY_POINTS, ) -def test_entry_points_exposed(entry_points_group: str) -> None: - """Verify the plugin entry point is discoverable. - - This check relies on the plugin-declaring distribution package to be - pre-installed. - """ - entry_points = _discover_entry_points(group=entry_points_group) - assert 'x' in entry_points.names +class TestEntryPoints: + def test_entry_points_exposed( + self, + entry_points_group: str, + expected_entry_point_name: str, + expected_entry_point_module: str, + expected_entry_point_func: str, + ) -> None: + """Verify the plugin entry point is discoverable. - assert entry_points['x'].value == 'awx_plugins.credentials.x.api:XPlugin' + This check relies on the plugin-declaring distribution package + to be pre-installed. + """ + entry_points = _discover_entry_points(group=entry_points_group) + assert expected_entry_point_name in entry_points.names + assert entry_points[expected_entry_point_name].value == f'{entry_points_group}.{expected_entry_point_module}:{expected_entry_point_func}' - assert callable(entry_points['x'].load()) + def test_entry_points_are_credential_plugin( + self, + entry_points_group: str, + expected_entry_point_name: str, + expected_entry_point_module: str, + expected_entry_point_func: str, + ) -> None: + entry_points = _discover_entry_points(group=entry_points_group) + assert type( + entry_points[expected_entry_point_name].load(), + ).__name__ == 'CredentialPlugin'