start updating tests to JT factory

This commit is contained in:
AlanCoding
2016-05-27 11:39:38 -04:00
parent cfd9d5d4f1
commit 07cc99b4c7

View File

@@ -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,