def test_ls(self): """ Tests if it list devices in Server Density. """ with patch.dict(serverdensity_device.__pillar__, {"serverdensity": {"api_token": "salt"}}): MockRequests.flag = 0 MockJson.flag = 0 self.assertTrue(serverdensity_device.ls(name="lama")) MockJson.flag = 1 self.assertRaises(CommandExecutionError, serverdensity_device.ls, name="lama") MockRequests.flag = 1 self.assertIsNone(serverdensity_device.ls(name="lama"))
def test_ls(self): ''' Tests if it list devices in Server Density. ''' with patch.dict(serverdensity_device.__pillar__, {'serverdensity': {'api_token': 'salt'}}): MockRequests.flag = 0 MockJson.flag = 0 self.assertTrue(serverdensity_device.ls(name='lama')) MockJson.flag = 1 self.assertRaises(CommandExecutionError, serverdensity_device.ls, name='lama') MockRequests.flag = 1 self.assertIsNone(serverdensity_device.ls(name='lama'))
def test_ls(self): ''' Tests if it list devices in Server Density. ''' with patch.dict(serverdensity_device.__pillar__, {'serverdensity': {'api_token': 'salt'}}): MockRequests.flag = 0 MockJson.flag = 0 self.assertTrue(serverdensity_device.ls(name='lama')) MockJson.flag = 1 self.assertRaises(CommandExecutionError, serverdensity_device.ls, name='lama') MockRequests.flag = 1 self.assertIsNone(serverdensity_device.ls(name='lama'))
def test_ls(self): """ Tests if it list devices in Server Density. """ with patch.dict(serverdensity_device.__pillar__, {"serverdensity": { "api_token": "salt" }}): MockRequests.flag = 0 self.assertTrue(serverdensity_device.ls(name="lama")) with patch.object(salt.utils.json, "loads", self.mock_json_loads): self.assertRaises(CommandExecutionError, serverdensity_device.ls, name="lama") MockRequests.flag = 1 self.assertIsNone(serverdensity_device.ls(name="lama"))