mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 23:41:23 -03:30
20 lines
499 B
Python
20 lines
499 B
Python
import subprocess
|
|
|
|
from awx.main.utils import get_ansible_version
|
|
|
|
def test_dev(mocker, settings):
|
|
settings.ANSIBLE_VERSION = mocker.Mock()
|
|
|
|
res = get_ansible_version()
|
|
|
|
assert res == settings.ANSIBLE_VERSION
|
|
|
|
def test_production(mocker, settings):
|
|
mock_Popen = mocker.MagicMock()
|
|
mocker.patch.object(subprocess, 'Popen', mock_Popen)
|
|
del settings.ANSIBLE_VERSION
|
|
|
|
get_ansible_version()
|
|
|
|
mock_Popen.assert_called_with(['ansible', '--version'], stdout=subprocess.PIPE)
|