These tests make no sense now that the proxy interface is module based and not object based.

This commit is contained in:
C. R. Oldham 2015-08-08 14:26:07 -06:00
parent b17b65d4de
commit 28329fff55
2 changed files with 0 additions and 159 deletions

View File

@ -1,78 +0,0 @@
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch)
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Libs
from salt.modules import rest_package
# Globals
rest_package.__opts__ = {}
@skipIf(NO_MOCK, NO_MOCK_REASON)
class RestPkgTestCase(TestCase):
'''
Test cases for salt.modules.rest_package
'''
def test_list_pkgs(self):
'''
Test for list pkgs
'''
with patch.dict(rest_package.__opts__, {'proxyobject': MagicMock()}):
self.assertTrue(rest_package.list_pkgs())
def test_install(self):
'''
Test for install
'''
with patch.dict(rest_package.__opts__, {'proxyobject': MagicMock()}):
self.assertTrue(rest_package.install())
def test_remove(self):
'''
Test for remove
'''
with patch.dict(rest_package.__opts__, {'proxyobject': MagicMock()}):
self.assertTrue(rest_package.remove())
def test_version(self):
'''
Test to return a string representing the package version or
an empty string if not installed.
'''
with patch.dict(rest_package.__opts__, {'proxyobject': MagicMock()}):
self.assertTrue(rest_package.version('A'))
def test_installed(self):
'''
Test for installed
'''
with patch.dict(rest_package.__opts__, {'proxyobject': MagicMock()}):
with patch.object(rest_package.__opts__['proxyobject'],
'package_status',
MagicMock(return_value={'ret': 'ret'})):
self.assertEqual(rest_package.installed('name'), 'ret')
self.assertTrue(rest_package.installed('name'))
self.assertFalse(rest_package.installed('name', version='v'))
if __name__ == '__main__':
from integration import run_tests
run_tests(RestPkgTestCase, needs_daemon=False)

View File

@ -1,81 +0,0 @@
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch)
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt Libs
from salt.modules import rest_service
# Globals
rest_service.__opts__ = {}
@skipIf(NO_MOCK, NO_MOCK_REASON)
class RestSvcTestCase(TestCase):
'''
Test cases for salt.modules.rest_service
'''
def test_start(self):
'''
Test to start the specified service
'''
with patch.dict(rest_service.__opts__, {'proxyobject': MagicMock()}):
with patch.object(rest_service.__opts__['proxyobject'],
'service_start', MagicMock(return_value=True)):
self.assertTrue(rest_service.start('name'))
def test_stop(self):
'''
Test to stop the specified service
'''
with patch.dict(rest_service.__opts__, {'proxyobject': MagicMock()}):
with patch.object(rest_service.__opts__['proxyobject'],
'service_stop', MagicMock(return_value=True)):
self.assertTrue(rest_service.stop('name'))
def test_restart(self):
'''
Test to restart the named service
'''
with patch.dict(rest_service.__opts__, {'proxyobject': MagicMock()}):
with patch.object(rest_service.__opts__['proxyobject'],
'service_restart', MagicMock(return_value=True)):
self.assertTrue(rest_service.restart('name'))
def test_status(self):
'''
Test to return the status for a service, returns a bool whether
the service is running.
'''
with patch.dict(rest_service.__opts__, {'proxyobject': MagicMock()}):
with patch.object(rest_service.__opts__['proxyobject'],
'service_status', MagicMock(return_value=True)):
self.assertTrue(rest_service.status('name'))
def test_list_(self):
'''
Test for list services.
'''
with patch.dict(rest_service.__opts__, {'proxyobject': MagicMock()}):
with patch.object(rest_service.__opts__['proxyobject'],
'service_list_', MagicMock(return_value=True)):
self.assertTrue(rest_service.list_())
if __name__ == '__main__':
from integration import run_tests
run_tests(RestSvcTestCase, needs_daemon=False)