def test_delete(self): """ Tests if it delete a device from Server Density. """ with patch.dict(serverdensity_device.__pillar__, {"serverdensity": {"api_token": "salt"}}): MockRequests.flag = 0 MockJson.flag = 0 self.assertTrue(serverdensity_device.delete("51f7eaf")) MockJson.flag = 1 self.assertRaises(CommandExecutionError, serverdensity_device.delete, "51f7eaf") MockRequests.flag = 1 self.assertIsNone(serverdensity_device.delete("51f7eaf"))
def test_delete(self): ''' Tests if it delete a device from Server Density. ''' with patch.dict(serverdensity_device.__pillar__, {'serverdensity': {'api_token': 'salt'}}): MockRequests.flag = 0 MockJson.flag = 0 self.assertTrue(serverdensity_device.delete('51f7eaf')) MockJson.flag = 1 self.assertRaises(CommandExecutionError, serverdensity_device.delete, '51f7eaf') MockRequests.flag = 1 self.assertIsNone(serverdensity_device.delete('51f7eaf'))
def test_delete(self): """ Tests if it delete a device from Server Density. """ with patch.dict(serverdensity_device.__pillar__, {"serverdensity": { "api_token": "salt" }}): MockRequests.flag = 0 self.assertTrue(serverdensity_device.delete("51f7eaf")) with patch.object(salt.utils.json, "loads", self.mock_json_loads): self.assertRaises(CommandExecutionError, serverdensity_device.delete, "51f7eaf") MockRequests.flag = 1 self.assertIsNone(serverdensity_device.delete("51f7eaf"))