mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
migrate test_uwsgi to pytest
This commit is contained in:
parent
6332632ddd
commit
6acb5509ad
1 changed files with 27 additions and 0 deletions
27
tests/pytests/unit/modules/test_uwsgi.py
Normal file
27
tests/pytests/unit/modules/test_uwsgi.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""
|
||||
Test cases for salt.modules.uswgi
|
||||
"""
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.modules.uwsgi as uwsgi
|
||||
from tests.support.mock import MagicMock, Mock, patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def configure_loader_modules():
|
||||
with patch("salt.utils.path.which", Mock(return_value="/usr/bin/uwsgi")):
|
||||
return {uwsgi: {}}
|
||||
|
||||
|
||||
def test_uwsgi_stats():
|
||||
socket = "127.0.0.1:5050"
|
||||
mock = MagicMock(return_value='{"a": 1, "b": 2}')
|
||||
with patch.dict(uwsgi.__salt__, {"cmd.run": mock}):
|
||||
result = uwsgi.stats(socket)
|
||||
mock.assert_called_once_with(
|
||||
["uwsgi", "--connect-and-read", "{}".format(socket)],
|
||||
python_shell=False,
|
||||
)
|
||||
assert result == {"a": 1, "b": 2}
|
Loading…
Add table
Reference in a new issue