-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some more tests out of root functional folder
- Loading branch information
1 parent
ad706d6
commit 154b8aa
Showing
7 changed files
with
61 additions
and
60 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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.') | ||
mock_run = mocker.patch('awx.main.tasks.jobs.ansible_runner.interface.run') | ||
try: | ||
RunJob().run(job.id) | ||
except Exception: | ||
pass | ||
job.refresh_from_db() | ||
assert job.status == 'failed' | ||
mock_run.assert_not_called() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.