mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 03:01:06 -03:30
start updating tests to JT factory
This commit is contained in:
@@ -188,24 +188,23 @@ def test_jt_admin_copy_edit_functional(jt_copy_edit, rando, get, post):
|
|||||||
assert post_response.status_code == 403
|
assert post_response.status_code == 403
|
||||||
|
|
||||||
# Validation function tests
|
# Validation function tests
|
||||||
# TODO: replace these JT creations with Wayne's new awesome factories
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_missing_project_error(inventory, machine_credential):
|
def test_missing_project_error(job_template_factory):
|
||||||
obj = JobTemplate.objects.create(
|
objects = job_template_factory(
|
||||||
job_type='run',
|
'missing-project-jt',
|
||||||
project=None,
|
organization='org1',
|
||||||
inventory=inventory,
|
inventory='inventory1',
|
||||||
credential=machine_credential,
|
credential='cred1',
|
||||||
name='missing-project-jt'
|
persisted=False)
|
||||||
)
|
obj = objects.job_template
|
||||||
assert 'project' in obj.resources_needed_to_start
|
assert 'project' in obj.resources_needed_to_start
|
||||||
validation_errors, resources_needed_to_start = obj.resource_validation_data()
|
validation_errors, resources_needed_to_start = obj.resource_validation_data()
|
||||||
assert 'project' in validation_errors
|
assert 'project' in validation_errors
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_inventory_credential_contradictions(project):
|
def test_inventory_credential_contradictions(project):
|
||||||
obj = JobTemplate.objects.create(
|
obj = JobTemplate(
|
||||||
job_type='run',
|
job_type='run',
|
||||||
project=project,
|
project=project,
|
||||||
inventory=None, ask_inventory_on_launch=False,
|
inventory=None, ask_inventory_on_launch=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user