mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
migrate test_esxdatacenter to pytest
This commit is contained in:
parent
efdb0722ce
commit
6870679c1c
2 changed files with 24 additions and 25 deletions
24
tests/pytests/unit/modules/test_esxdatacenter.py
Normal file
24
tests/pytests/unit/modules/test_esxdatacenter.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
"""
|
||||
:codeauthor: :email:`Alexandru Bleotu <alexandru.bleotu@morganstanley.com>`
|
||||
|
||||
Tests for functions in salt.modules.esxdatacenter
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.modules.esxdatacenter as esxdatacenter
|
||||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def configure_loader_modules():
|
||||
return {esxdatacenter: {"__proxy__": {}}}
|
||||
|
||||
|
||||
def test_get_details():
|
||||
mock_get_details = MagicMock()
|
||||
with patch.dict(
|
||||
esxdatacenter.__proxy__, {"esxdatacenter.get_details": mock_get_details}
|
||||
):
|
||||
esxdatacenter.get_details()
|
||||
mock_get_details.assert_called_once_with()
|
|
@ -1,25 +0,0 @@
|
|||
"""
|
||||
:codeauthor: :email:`Alexandru Bleotu <alexandru.bleotu@morganstanley.com>`
|
||||
|
||||
Tests for functions in salt.modules.esxdatacenter
|
||||
"""
|
||||
|
||||
import salt.modules.esxdatacenter as esxdatacenter
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.mock import MagicMock, patch
|
||||
from tests.support.unit import TestCase
|
||||
|
||||
|
||||
class GetDetailsTestCase(TestCase, LoaderModuleMockMixin):
|
||||
"""Tests for salt.modules.esxdatacenter.get_details"""
|
||||
|
||||
def setup_loader_modules(self):
|
||||
return {esxdatacenter: {"__proxy__": {}}}
|
||||
|
||||
def test_get_details(self):
|
||||
mock_get_details = MagicMock()
|
||||
with patch.dict(
|
||||
esxdatacenter.__proxy__, {"esxdatacenter.get_details": mock_get_details}
|
||||
):
|
||||
esxdatacenter.get_details()
|
||||
mock_get_details.assert_called_once_with()
|
Loading…
Add table
Reference in a new issue