コード例 #1
0
    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"))
コード例 #2
0
    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'))
コード例 #3
0
    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'))
コード例 #4
0
    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"))