Ejemplo n.º 1
0
    def test_servicegroup_server_add(self):
        """
        Tests if it add a server:port member to a servicegroup
        """
        mock = MagicMock(return_value="")
        with patch.dict(netscaler.__salt__, {"config.option": mock}):
            with patch.object(netscaler, "_connect", MagicMock(return_value=None)):
                self.assertFalse(netscaler.servicegroup_server_add("serGrpName", "serverName", "sPort"))

            MockNSNitro.flag = None
            self.assertTrue(netscaler.servicegroup_server_add("serGrpName", "serverName", "serverPort"))

            mock = MagicMock(return_value=MockNSServiceGroupServerBinding())
            with patch.object(netscaler, "_servicegroup_get_server", mock):
                MockNSNitro.flag = True
                self.assertFalse(netscaler.servicegroup_server_add("serviceGroupName", "serverName", "serPort"))
Ejemplo n.º 2
0
    def test_servicegroup_server_add(self):
        '''
        Tests if it add a server:port member to a servicegroup
        '''
        mock = MagicMock(return_value='')
        with patch.dict(netscaler.__salt__, {'config.option': mock}):
            with patch.object(netscaler, '_connect',
                              MagicMock(return_value=None)):
                self.assertFalse(
                    netscaler.servicegroup_server_add('serGrpName',
                                                      'serverName', 'sPort'))

            MockNSNitro.flag = None
            self.assertTrue(
                netscaler.servicegroup_server_add('serGrpName', 'serverName',
                                                  'serverPort'))

            mock = MagicMock(return_value=MockNSServiceGroupServerBinding())
            with patch.object(netscaler, '_servicegroup_get_server', mock):
                MockNSNitro.flag = True
                self.assertFalse(
                    netscaler.servicegroup_server_add('serviceGroupName',
                                                      'serverName', 'serPort'))
Ejemplo n.º 3
0
    def test_servicegroup_server_add(self):
        """
        Tests if it add a server:port member to a servicegroup
        """
        mock = MagicMock(return_value="")
        with patch.dict(netscaler.__salt__, {"config.option": mock}):
            with patch.object(netscaler, "_connect",
                              MagicMock(return_value=None)):
                self.assertFalse(
                    netscaler.servicegroup_server_add("serGrpName",
                                                      "serverName", "sPort"))

            MockNSNitro.flag = None
            self.assertTrue(
                netscaler.servicegroup_server_add("serGrpName", "serverName",
                                                  "serverPort"))

            mock = MagicMock(return_value=MockNSServiceGroupServerBinding())
            with patch.object(netscaler, "_servicegroup_get_server", mock):
                MockNSNitro.flag = True
                self.assertFalse(
                    netscaler.servicegroup_server_add("serviceGroupName",
                                                      "serverName", "serPort"))