def test_server_add(self): """ Tests if it add a server """ mock = MagicMock(return_value="") with patch.dict(netscaler.__salt__, {"config.option": mock}): self.assertFalse(netscaler.server_add("servGrpName", "1.0.0.1")) with patch.object(netscaler, "_connect", MagicMock(return_value=None)): self.assertFalse(netscaler.server_add("serviceGrpName", "1.0.0.1")) mock = MagicMock(return_value=False) with patch.object(netscaler, "server_exists", mock): self.assertTrue(netscaler.server_add("serviceGrpName", "1.0.0.1"))
def test_server_add(self): ''' Tests if it add a server ''' mock = MagicMock(return_value='') with patch.dict(netscaler.__salt__, {'config.option': mock}): self.assertFalse(netscaler.server_add('servGrpName', '1.0.0.1')) with patch.object(netscaler, '_connect', MagicMock(return_value=None)): self.assertFalse( netscaler.server_add('serviceGrpName', '1.0.0.1')) mock = MagicMock(return_value=False) with patch.object(netscaler, 'server_exists', mock): self.assertTrue( netscaler.server_add('serviceGrpName', '1.0.0.1'))
def test_server_add(self): """ Tests if it add a server """ mock = MagicMock(return_value="") with patch.dict(netscaler.__salt__, {"config.option": mock}): self.assertFalse(netscaler.server_add("servGrpName", "1.0.0.1")) with patch.object(netscaler, "_connect", MagicMock(return_value=None)): self.assertFalse( netscaler.server_add("serviceGrpName", "1.0.0.1")) mock = MagicMock(return_value=False) with patch.object(netscaler, "server_exists", mock): self.assertTrue( netscaler.server_add("serviceGrpName", "1.0.0.1"))