From 28329fff5530634a4c9e7e1f4312d4968cb8ef47 Mon Sep 17 00:00:00 2001 From: "C. R. Oldham" Date: Sat, 8 Aug 2015 14:26:07 -0600 Subject: [PATCH] These tests make no sense now that the proxy interface is module based and not object based. --- tests/unit/modules/rest_package_test.py | 78 ------------------------ tests/unit/modules/rest_service_test.py | 81 ------------------------- 2 files changed, 159 deletions(-) delete mode 100644 tests/unit/modules/rest_package_test.py delete mode 100644 tests/unit/modules/rest_service_test.py diff --git a/tests/unit/modules/rest_package_test.py b/tests/unit/modules/rest_package_test.py deleted file mode 100644 index 3fc12d0539..0000000000 --- a/tests/unit/modules/rest_package_test.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -''' - :codeauthor: :email:`Jayesh Kariya ` -''' -# 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) diff --git a/tests/unit/modules/rest_service_test.py b/tests/unit/modules/rest_service_test.py deleted file mode 100644 index 16e05490c4..0000000000 --- a/tests/unit/modules/rest_service_test.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- -''' - :codeauthor: :email:`Jayesh Kariya ` -''' -# 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)