diff --git a/.coveragerc b/.coveragerc index 6d5c35a0e6..4edd3a015d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -31,4 +31,4 @@ relative_files = true source = tests source_pkgs = - awx_plugins.credentials.x.api + awx_plugins.credentials diff --git a/dependencies/direct/py.in b/dependencies/direct/py.in index 482a00759e..63801dcda0 100644 --- a/dependencies/direct/py.in +++ b/dependencies/direct/py.in @@ -1,8 +1,15 @@ -c py-constraints.in # limits known broken versions +azure-identity # credentials.azure_kv +azure-keyvault # credentials.azure_kv +boto3 # credentials.awx_secretsmanager covdefaults coverage # accessed directly from tox coverage-enable-subprocess +msrestazure # credentials.azure_kv pytest pytest-cov +python-dsv-sdk >= 1.0.4 # credentials.thycotic_dsv +python-tss-sdk >= 1.2.1 # credentials.thycotic_tss pytest-xdist +requests # credentials.aim, credentials.centrify_vault, credentials.conjur, credentials.hashivault 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..8d1577a6ea 100644 --- a/tests/importable_test.py +++ b/tests/importable_test.py @@ -1,6 +1,8 @@ """Smoke tests related to loading entry points.""" from importlib.metadata import entry_points as _discover_entry_points +from subprocess import check_call as _invoke_command +from sys import executable as _current_runtime import pytest @@ -8,7 +10,6 @@ @pytest.mark.parametrize( 'entry_points_group', ( - 'awx.credential_plugins', 'awx_plugins.credentials', ), ) @@ -19,8 +20,32 @@ def test_entry_points_exposed(entry_points_group: str) -> None: pre-installed. """ entry_points = _discover_entry_points(group=entry_points_group) - assert 'x' in entry_points.names + expected_entry_points = { + 'aim': 'aim_plugin', + 'conjur': 'conjur_plugin', + 'hashivault_kv': 'hashivault_kv_plugin', + 'hashivault_ssh': 'hashivault_ssh_plugin', + 'azure_kv': 'azure_keyvault_plugin', + 'centrify_vault_kv': 'centrify_plugin', + 'thycotic_dsv': 'dsv_plugin', + 'thycotic_tss': 'tss_plugin', + 'aws_secretsmanager_credential': 'aws_secretmanager_plugin', + } + for x in expected_entry_points.keys(): + assert x in entry_points.names - assert entry_points['x'].value == 'awx_plugins.credentials.x.api:XPlugin' + for k, v in expected_entry_points.items(): + callable_ref_spec = entry_points[k].value + import_ref, callable_sep, callable_ref = callable_ref_spec.partition( + ':') + assert callable_sep + assert v == str(callable_ref) - assert callable(entry_points['x'].load()) + test_is_importable_callable_cmd = ( + _current_runtime, + '-c', + f'from sys import exit; ' + f'from {import_ref} import {callable_ref}; ' + f'exit(not type({callable_ref}).__name__ == "CredentialPlugin")', + ) + _invoke_command(test_is_importable_callable_cmd)