Esempio n. 1
0
    def test_service_enable(self):
        """
        Tests if it enable a service
        """
        mock = MagicMock(return_value="")
        with patch.dict(netscaler.__salt__, {"config.option": mock}):
            self.assertTrue(netscaler.service_enable("serviceGrpName"))

            with patch.object(netscaler, "_connect", MagicMock(return_value=None)):
                self.assertFalse(netscaler.service_enable("serviceGrpName"))

                mock = MagicMock(return_value=MockNSService())
                with patch.object(netscaler, "_service_get", mock):
                    self.assertFalse(netscaler.service_enable("serGrpName"))
Esempio n. 2
0
    def test_service_enable(self):
        '''
        Tests if it enable a service
        '''
        mock = MagicMock(return_value='')
        with patch.dict(netscaler.__salt__, {'config.option': mock}):
            self.assertTrue(netscaler.service_enable('serviceGrpName'))

            with patch.object(netscaler, '_connect',
                              MagicMock(return_value=None)):
                self.assertFalse(netscaler.service_enable('serviceGrpName'))

                mock = MagicMock(return_value=MockNSService())
                with patch.object(netscaler, '_service_get', mock):
                    self.assertFalse(netscaler.service_enable('serGrpName'))
Esempio n. 3
0
    def test_service_enable(self):
        """
        Tests if it enable a service
        """
        mock = MagicMock(return_value="")
        with patch.dict(netscaler.__salt__, {"config.option": mock}):
            self.assertTrue(netscaler.service_enable("serviceGrpName"))

            with patch.object(netscaler, "_connect",
                              MagicMock(return_value=None)):
                self.assertFalse(netscaler.service_enable("serviceGrpName"))

                mock = MagicMock(return_value=MockNSService())
                with patch.object(netscaler, "_service_get", mock):
                    self.assertFalse(netscaler.service_enable("serGrpName"))