Пример #1
0
    def test_servicegroup_delete(self):
        """
        Tests if it delete a new service group
        """
        mock = MagicMock(return_value="")
        with patch.dict(netscaler.__salt__, {"config.option": mock}):
            MockNSNitro.flag = None
            self.assertTrue(netscaler.servicegroup_delete("serviceGrpName"))

            mock = MagicMock(side_effect=[None, MockNSServiceGroup()])
            with patch.object(netscaler, "_servicegroup_get", mock):
                MockNSNitro.flag = True
                self.assertFalse(netscaler.servicegroup_delete("srGrpName"))

                with patch.object(netscaler, "_connect", MagicMock(return_value=None)):
                    self.assertFalse(netscaler.servicegroup_delete("sGNam"))
Пример #2
0
    def test_servicegroup_delete(self):
        '''
        Tests if it delete a new service group
        '''
        mock = MagicMock(return_value='')
        with patch.dict(netscaler.__salt__, {'config.option': mock}):
            MockNSNitro.flag = None
            self.assertTrue(netscaler.servicegroup_delete('serviceGrpName'))

            mock = MagicMock(side_effect=[None, MockNSServiceGroup()])
            with patch.object(netscaler, '_servicegroup_get', mock):
                MockNSNitro.flag = True
                self.assertFalse(netscaler.servicegroup_delete('srGrpName'))

                with patch.object(netscaler, '_connect',
                                  MagicMock(return_value=None)):
                    self.assertFalse(netscaler.servicegroup_delete('sGNam'))
Пример #3
0
    def test_servicegroup_delete(self):
        """
        Tests if it delete a new service group
        """
        mock = MagicMock(return_value="")
        with patch.dict(netscaler.__salt__, {"config.option": mock}):
            MockNSNitro.flag = None
            self.assertTrue(netscaler.servicegroup_delete("serviceGrpName"))

            mock = MagicMock(side_effect=[None, MockNSServiceGroup()])
            with patch.object(netscaler, "_servicegroup_get", mock):
                MockNSNitro.flag = True
                self.assertFalse(netscaler.servicegroup_delete("srGrpName"))

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