def test_delete(self):
        """
        Test if it delete a value from an OpenStack configuration file.
        """
        mock = MagicMock(return_value={
            "retcode": 0,
            "stderr": "error",
            "stdout": "salt"
        })
        with patch.dict(openstack_config.__salt__, {"cmd.run_all": mock}):
            self.assertEqual(
                openstack_config.delete("/etc/keystone/keys.conf", "sql",
                                        "connection"),
                "salt",
            )

        mock = MagicMock(return_value={
            "retcode": 1,
            "stderr": "error",
            "stdout": "salt"
        })
        with patch.dict(openstack_config.__salt__, {"cmd.run_all": mock}):
            self.assertRaises(
                CommandExecutionError,
                openstack_config.delete,
                "/etc/key/keystone.conf",
                "sql",
                "connection",
            )
Example #2
0
    def test_delete(self):
        '''
        Test if it delete a value from an OpenStack configuration file.
        '''
        mock = MagicMock(return_value={'retcode': 0, 'stderr': 'error',
                                       'stdout': 'salt'})
        with patch.dict(openstack_config.__salt__, {'cmd.run_all': mock}):
            self.assertEqual(openstack_config.delete('/etc/keystone/keys.conf',
                                                     'sql', 'connection'),
                             'salt')

        mock = MagicMock(return_value={'retcode': 1, 'stderr': 'error',
                                       'stdout': 'salt'})
        with patch.dict(openstack_config.__salt__, {'cmd.run_all': mock}):
            self.assertRaises(CommandExecutionError, openstack_config.delete,
                              '/etc/key/keystone.conf', 'sql', 'connection')
Example #3
0
    def test_delete(self):
        '''
        Test if it delete a value from an OpenStack configuration file.
        '''
        mock = MagicMock(return_value={'retcode': 0, 'stderr': 'error',
                                       'stdout': 'salt'})
        with patch.dict(openstack_config.__salt__, {'cmd.run_all': mock}):
            self.assertEqual(openstack_config.delete('/etc/keystone/keys.conf',
                                                     'sql', 'connection'),
                             'salt')

        mock = MagicMock(return_value={'retcode': 1, 'stderr': 'error',
                                       'stdout': 'salt'})
        with patch.dict(openstack_config.__salt__, {'cmd.run_all': mock}):
            self.assertRaises(CommandExecutionError, openstack_config.delete,
                              '/etc/key/keystone.conf', 'sql', 'connection')