1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Merge pull request #820 from ryanpetrello/devel

fix a number of failing unit tests related to the 3.2.2 merge
This commit is contained in:
Ryan Petrello 2017-12-13 13:04:55 -05:00 committed by GitHub
commit 9f8ef4d1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View File

@ -1041,8 +1041,6 @@ class RunJob(BaseTask):
env['ANSIBLE_STDOUT_CALLBACK'] = 'awx_display'
env['TOWER_HOST'] = settings.TOWER_URL_BASE
env['AWX_HOST'] = settings.TOWER_URL_BASE
env['REST_API_URL'] = settings.INTERNAL_API_URL
env['REST_API_TOKEN'] = job.task_auth_token or ''
env['CACHE'] = settings.CACHES['default']['LOCATION'] if 'LOCATION' in settings.CACHES['default'] else ''
# Create a directory for ControlPath sockets that is unique to each
@ -2100,8 +2098,6 @@ class RunAdHocCommand(BaseTask):
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_dir
env['ANSIBLE_LOAD_CALLBACK_PLUGINS'] = '1'
env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal' # Hardcoded by Ansible for ad-hoc commands (either minimal or oneline).
env['REST_API_URL'] = settings.INTERNAL_API_URL
env['REST_API_TOKEN'] = ad_hoc_command.task_auth_token or ''
env['ANSIBLE_SFTP_BATCH_MODE'] = 'False'
env['CACHE'] = settings.CACHES['default']['LOCATION'] if 'LOCATION' in settings.CACHES['default'] else ''

View File

@ -202,13 +202,16 @@ class TestJobExecution:
mock.patch.object(Project, 'get_project_path', lambda *a, **kw: self.project_path),
# don't emit websocket statuses; they use the DB and complicate testing
mock.patch.object(UnifiedJob, 'websocket_emit_status', mock.Mock()),
mock.patch.object(Job, 'inventory', mock.Mock(
mock.patch('awx.main.expect.run.run_pexpect', self.run_pexpect),
]
for cls in (Job, AdHocCommand):
self.patches.append(
mock.patch.object(cls, 'inventory', mock.Mock(
pk=1,
get_script_data=lambda *args, **kw: self.INVENTORY_DATA,
spec_set=['pk', 'get_script_data']
)),
mock.patch('awx.main.expect.run.run_pexpect', self.run_pexpect)
]
))
)
for p in self.patches:
p.start()
@ -352,7 +355,6 @@ class TestAdhocRun(TestJobExecution):
return AdHocCommand(
pk=1,
created=datetime.utcnow(),
inventory=Inventory(pk=1),
status='new',
cancel_flag=False,
verbosity=3,
@ -813,7 +815,7 @@ class TestJobCredentials(TestJobExecution):
inputs=inputs
)
credential.inputs['password'] = encrypt_field(credential, 'password')
self.instance.extra_credentials.add(credential)
self.instance.credentials.add(credential)
def run_pexpect_side_effect(*args, **kwargs):
args, cwd, env, stdout = args