Skip to content

Commit 53ebc59

Browse files
Merge pull request #77 from chrismeyersfsu/AAP-36844-managed-creds-unit-tests
Move plugin test out of awx into here
2 parents ec19a5a + 82d33e5 commit 53ebc59

File tree

5 files changed

+579
-18
lines changed

5 files changed

+579
-18
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ per-file-ignores =
125125
src/awx_plugins/inventory/plugins.py: ANN001, ANN002, ANN003, ANN101, ANN102, ANN201, ANN202, ANN206, B950, C812, C819, D100, D101, D102, D205, D209, D400, D401, LN001, LN002, N801, WPS110, WPS111, WPS202, WPS210, WPS214, WPS301, WPS319, WPS324, WPS331, WPS336, WPS337, WPS338, WPS347, WPS421, WPS433, WPS450, WPS510, WPS529
126126
tests/credential_plugins_test.py: ANN101, B017, C419, D100, D102, D103, D205, D209, D400, DAR, PT011, S105, WPS111, WPS117, WPS118, WPS202, WPS352, WPS421, WPS433, WPS507, WPS441
127127
tests/importable_test.py: ANN101, DAR
128+
tests/managed_credential_plugins_test.py: DAR, DCO020, S101, S105, S108, S404, S603, WPS201, WPS202, WPS210, WPS430, WPS436, WPS441, WPS442, WPS450
128129

129130
# Count the number of occurrences of each error/warning code and print a report:
130131
statistics = true

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ repos:
130130
# args:
131131
# - --unsafe
132132
- id: detect-private-key
133+
exclude: tests/managed_credential_plugins_test.py
133134

134135
# Heavy checks:
135136
- id: check-ast
@@ -193,7 +194,7 @@ repos:
193194
name: MyPy, for Python 3.13
194195
additional_dependencies:
195196
- >- # standard interface declarations for AWX plugins
196-
awx_plugins.interfaces == 0.0.1a3
197+
awx_plugins.interfaces == 0.0.1a4
197198
- azure-identity # needed by credentials.azure_kv
198199
- azure-keyvault # needed by credentials.azure_kv
199200
- boto3-stubs # needed by credentials.awx_secretsmanager
@@ -224,7 +225,7 @@ repos:
224225
name: MyPy, for Python 3.12
225226
additional_dependencies:
226227
- >- # standard interface declarations for AWX plugins
227-
awx_plugins.interfaces == 0.0.1a3
228+
awx_plugins.interfaces == 0.0.1a4
228229
- azure-identity # needed by credentials.azure_kv
229230
- azure-keyvault # needed by credentials.azure_kv
230231
- boto3-stubs # needed by credentials.awx_secretsmanager
@@ -255,7 +256,7 @@ repos:
255256
name: MyPy, for Python 3.11
256257
additional_dependencies:
257258
- >- # standard interface declarations for AWX plugins
258-
awx_plugins.interfaces == 0.0.1a3
259+
awx_plugins.interfaces == 0.0.1a4
259260
- azure-identity # needed by credentials.azure_kv
260261
- azure-keyvault # needed by credentials.azure_kv
261262
- boto3-stubs # needed by credentials.awx_secretsmanager
@@ -288,7 +289,7 @@ repos:
288289
- id: pylint
289290
additional_dependencies:
290291
- >- # standard interface declarations for AWX plugins
291-
awx_plugins.interfaces == 0.0.1a3
292+
awx_plugins.interfaces == 0.0.1a4
292293
- azure-identity # needed by credentials.azure_kv
293294
- azure-keyvault # needed by credentials.azure_kv
294295
- boto3 # needed by credentials.awx_secretsmanager

dependencies/direct/py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ covdefaults
44
coverage # accessed directly from tox
55
coverage-enable-subprocess
66
hypothesis
7+
Jinja2
78
pytest
89
pytest-cov
910
pytest-mock

src/awx_plugins/credentials/plugins.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@
99
)
1010

1111
from .injectors import (
12-
aws,
13-
azure_rm,
14-
gce,
15-
kubernetes_bearer_token,
16-
openstack,
17-
terraform,
18-
vmware,
12+
aws as aws_injector,
13+
azure_rm as azure_rm_injector,
14+
gce as gce_injector,
15+
kubernetes_bearer_token as kubernetes_bearer_token_injector,
16+
openstack as openstack_injector,
17+
terraform as terraform_injector,
18+
vmware as vmware_injector,
1919
)
2020

2121

22+
__all__ = () # noqa: WPS410
23+
24+
2225
ssh = ManagedCredentialType(
2326
namespace='ssh',
2427
kind='ssh',
2528
name=gettext_noop('Machine'),
29+
managed=True,
2630
inputs={
2731
'fields': [
2832
{
@@ -215,7 +219,7 @@
215219
kind='cloud',
216220
name=gettext_noop('Amazon Web Services'),
217221
managed=True,
218-
custom_injectors=aws,
222+
custom_injectors=aws_injector,
219223
inputs={
220224
'fields': [
221225
{
@@ -254,7 +258,7 @@
254258
kind='cloud',
255259
name=gettext_noop('OpenStack'),
256260
managed=True,
257-
custom_injectors=openstack,
261+
custom_injectors=openstack_injector,
258262
inputs={
259263
'fields': [
260264
{
@@ -328,7 +332,7 @@
328332
kind='cloud',
329333
name=gettext_noop('VMware vCenter'),
330334
managed=True,
331-
custom_injectors=vmware,
335+
custom_injectors=vmware_injector,
332336
inputs={
333337
'fields': [
334338
{
@@ -401,7 +405,7 @@
401405
kind='cloud',
402406
name=gettext_noop('Google Compute Engine'),
403407
managed=True,
404-
custom_injectors=gce,
408+
custom_injectors=gce_injector,
405409
inputs={
406410
'fields': [
407411
{
@@ -449,7 +453,7 @@
449453
kind='cloud',
450454
name=gettext_noop('Microsoft Azure Resource Manager'),
451455
managed=True,
452-
custom_injectors=azure_rm,
456+
custom_injectors=azure_rm_injector,
453457
inputs={
454458
'fields': [
455459
{
@@ -726,7 +730,8 @@
726730
namespace='kubernetes_bearer_token',
727731
kind='kubernetes',
728732
name=gettext_noop('OpenShift or Kubernetes API Bearer Token'),
729-
custom_injectors=kubernetes_bearer_token,
733+
managed=True,
734+
custom_injectors=kubernetes_bearer_token_injector,
730735
inputs={
731736
'fields': [
732737
{
@@ -766,6 +771,7 @@
766771
namespace='registry',
767772
kind='registry',
768773
name=gettext_noop('Container Registry'),
774+
managed=True,
769775
inputs={
770776
'fields': [
771777
{
@@ -807,6 +813,7 @@
807813
namespace='galaxy_api_token',
808814
kind='galaxy',
809815
name=gettext_noop('Ansible Galaxy/Automation Hub API Token'),
816+
managed=True,
810817
inputs={
811818
'fields': [
812819
{
@@ -845,6 +852,7 @@
845852
namespace='gpg_public_key',
846853
kind='cryptography',
847854
name=gettext_noop('GPG Public Key'),
855+
managed=True,
848856
inputs={
849857
'fields': [
850858
{
@@ -867,7 +875,7 @@
867875
kind='cloud',
868876
name=gettext_noop('Terraform backend configuration'),
869877
managed=True,
870-
custom_injectors=terraform,
878+
custom_injectors=terraform_injector,
871879
inputs={
872880
'fields': [
873881
{

0 commit comments

Comments
 (0)