Skip to content

Commit

Permalink
migrate test_uwsgi to pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
frogunder authored and dwoz committed Dec 12, 2023
1 parent ad06fc0 commit ca51e73
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
27 changes: 27 additions & 0 deletions tests/pytests/unit/modules/test_uwsgi.py
Original file line number Diff line number Diff line change
@@ -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}
23 changes: 0 additions & 23 deletions tests/unit/modules/test_uwsgi.py

This file was deleted.

0 comments on commit ca51e73

Please sign in to comment.