mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-24 00:41:48 -05:00
add mk_job to factories, use with survey passwords
This commit is contained in:
@@ -187,13 +187,8 @@ def notification_template(organization):
|
||||
headers={"Test": "Header"}))
|
||||
|
||||
@pytest.fixture
|
||||
def job_with_secret_key(job_template_factory):
|
||||
"Returns a job from a Job Template with secret_key as password question"
|
||||
objects = job_template_factory(
|
||||
'jt', organization='org1', survey=[{'variable': 'secret_key', 'type': 'password'}])
|
||||
job = objects.job_template.jobs.create(
|
||||
job_type="run", extra_vars=json.dumps({'secret_key': '6kQngg3h8lgiSTvIEb21'}))
|
||||
return job
|
||||
def job_with_secret_key(job_with_secret_key_factory):
|
||||
return job_with_secret_key_factory(persisted=True)
|
||||
|
||||
@pytest.fixture
|
||||
def admin(user):
|
||||
|
||||
@@ -77,7 +77,8 @@ def test_org_factory(organization_factory):
|
||||
def test_job_template_factory(job_template_factory):
|
||||
jt_objects = job_template_factory('testJT', organization='org1',
|
||||
project='proj1', inventory='inventory1',
|
||||
credential='cred1', survey='test-survey')
|
||||
credential='cred1', survey='test-survey',
|
||||
jobs=[1])
|
||||
assert jt_objects.job_template.name == 'testJT'
|
||||
assert jt_objects.project.name == 'proj1'
|
||||
assert jt_objects.inventory.name == 'inventory1'
|
||||
@@ -85,6 +86,7 @@ def test_job_template_factory(job_template_factory):
|
||||
assert jt_objects.inventory.organization.name == 'org1'
|
||||
assert jt_objects.job_template.survey_enabled is True
|
||||
assert jt_objects.job_template.survey_spec is not None
|
||||
assert 'test-survey' in jt_objects.jobs[1].extra_vars
|
||||
|
||||
def test_survey_spec_generator_simple(survey_spec_factory):
|
||||
survey_spec = survey_spec_factory('survey_variable')
|
||||
|
||||
Reference in New Issue
Block a user