Update tests for custom credentials

This commit is contained in:
Jim Ladd 2017-11-21 14:43:10 -05:00
parent 18178c83b3
commit 4b13bcdce2
No known key found for this signature in database
GPG Key ID: 07CD131B8ACCA940
2 changed files with 3 additions and 2 deletions

View File

@ -763,7 +763,7 @@ class CredentialTypeInjectorField(JSONSchemaField):
if 'template' not in template_names:
valid_namespace['tower'].filename = TowerNamespace()
for template_name in template_names:
template_name = template_name[9:]
template_name = template_name.split('.')[1]
setattr(valid_namespace['tower'].filename, template_name, 'EXAMPLE')
for type_, injector in value.items():

View File

@ -107,10 +107,11 @@ def test_cred_type_input_schema_validity(input_, valid):
({}, True),
({'invalid-injector': {}}, False),
({'file': 123}, False),
({'file': {}}, False),
({'file': {}}, True),
({'file': {'template': '{{username}}'}}, True),
({'file': {'template.username': '{{username}}'}}, True),
({'file': {'template.username': '{{username}}', 'template.password': '{{pass}}'}}, True),
({'file': {'template': '{{username}}', 'template.password': '{{pass}}'}}, False),
({'file': {'foo': 'bar'}}, False),
({'env': 123}, False),
({'env': {}}, True),