mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Removing some (but not all) dead pytest fixtures (#15782)
* Try removing dead fixtures * Add back in EE fixture
This commit is contained in:
parent
c6930bdf32
commit
d639953a4c
@ -140,11 +140,6 @@ def job_template_with_survey_passwords_factory(job_template_factory):
|
||||
return rf
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job_with_secret_key_unit(job_with_secret_key_factory):
|
||||
return job_with_secret_key_factory(persisted=False)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def workflow_job_template_factory():
|
||||
return create_workflow_job_template
|
||||
|
||||
@ -6,12 +6,6 @@ from awx.main.models import Credential, CredentialType, Job
|
||||
from awx.api.versioning import reverse
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def ec2_source(inventory, project):
|
||||
with mock.patch('awx.main.models.unified_jobs.UnifiedJobTemplate.update'):
|
||||
return inventory.inventory_sources.create(name='some_source', source='ec2', source_project=project)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job_template(job_template, project, inventory):
|
||||
job_template.playbook = 'helloworld.yml'
|
||||
|
||||
@ -17,15 +17,6 @@ def scm_inventory(inventory, project):
|
||||
return inventory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def factory_scm_inventory(inventory, project):
|
||||
def fn(**kwargs):
|
||||
with mock.patch('awx.main.models.unified_jobs.UnifiedJobTemplate.update'):
|
||||
return inventory.inventory_sources.create(source_project=project, overwrite_vars=True, source='scm', **kwargs)
|
||||
|
||||
return fn
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_inventory_source_notification_on_cloud_only(get, post, inventory_source_factory, user, notification_template):
|
||||
u = user('admin', True)
|
||||
|
||||
@ -38,11 +38,6 @@ def runtime_data(organization, credentialtype_ssh):
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job_with_links(machine_credential, inventory):
|
||||
return Job.objects.create(name='existing-job', credential=machine_credential, inventory=inventory)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def job_template_prompts(project, inventory, machine_credential):
|
||||
def rf(on_off):
|
||||
|
||||
@ -186,12 +186,6 @@ def team_factory(organization):
|
||||
return factory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_project(user):
|
||||
owner = user('owner')
|
||||
return Project.objects.create(name="test-user-project", created_by=owner, description="test-user-project-desc")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def insights_project():
|
||||
return Project.objects.create(name="test-insights-project", scm_type="insights")
|
||||
@ -341,13 +335,6 @@ def inventory(organization):
|
||||
return organization.inventories.create(name="test-inv")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def insights_inventory(inventory):
|
||||
inventory.scm_type = 'insights'
|
||||
inventory.save()
|
||||
return inventory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def scm_inventory_source(inventory, project):
|
||||
inv_src = InventorySource(
|
||||
@ -497,23 +484,6 @@ def group_factory(inventory):
|
||||
return g
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def hosts(group_factory):
|
||||
group1 = group_factory('group-1')
|
||||
|
||||
def rf(host_count=1):
|
||||
hosts = []
|
||||
for i in range(0, host_count):
|
||||
name = '%s-host-%s' % (group1.name, i)
|
||||
(host, created) = group1.inventory.hosts.get_or_create(name=name)
|
||||
if created:
|
||||
group1.hosts.add(host)
|
||||
hosts.append(host)
|
||||
return hosts
|
||||
|
||||
return rf
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def group(inventory):
|
||||
return inventory.groups.create(name='single-group')
|
||||
|
||||
@ -1,19 +1,9 @@
|
||||
import pytest
|
||||
import os
|
||||
|
||||
from awx.main.tasks.jobs import RunJob
|
||||
from awx.main.models import Job
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def scm_revision_file(tmpdir_factory):
|
||||
# Returns path to temporary testing revision file
|
||||
revision_file = tmpdir_factory.mktemp('revisions').join('revision.txt')
|
||||
with open(str(revision_file), 'w') as f:
|
||||
f.write('1234567890123456789012345678901234567890')
|
||||
return os.path.join(revision_file.dirname, 'revision.txt')
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_does_not_run_reaped_job(mocker, mock_me):
|
||||
job = Job.objects.create(status='failed', job_explanation='This job has been reaped.')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user