def _use_tmp_config_database(self):
     """
     Create a copy of the database and use this. This is useful if the
     database is modified during the test.
     """
     config_file = "%s/../data/config.xml" % os.getcwd()
     (fh, tmp_config_file) = tempfile.mkstemp()
     shutil.copy(config_file, tmp_config_file)
     openmediavault.setenv("OMV_CONFIG_FILE", tmp_config_file)
	def _use_tmp_config_database(self):
		"""
		Create a copy of the database and use this. This is useful if the
		database is modified during the test.
		"""
		config_file = "%s/../data/config.xml" % os.getcwd()
		(fh, tmp_config_file) = tempfile.mkstemp();
		shutil.copy(config_file, tmp_config_file)
		openmediavault.setenv("OMV_CONFIG_FILE", tmp_config_file)
 def setUp(self):
     # Tell the database implementation to use the test database.
     openmediavault.setenv("OMV_CONFIG_FILE",
                           "%s/../data/config.xml" % os.getcwd())
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# OpenMediaVault is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
import unittest
import os
import openmediavault
import openmediavault.config.object

openmediavault.setenv("OMV_CONFIG_FILE", "%s/data/config.xml" % os.getcwd())


class ConfigObjectTestCase(unittest.TestCase):
    def test_constructor(self):
        conf_obj = openmediavault.config.Object("conf.service.ftp.share")

    def test_get_defaults(self):
        conf_obj = openmediavault.config.Object("conf.service.ftp.share")
        defaults = conf_obj.get_defaults()
        self.assertEqual(
            defaults, {
                'comment': '',
                'enable': False,
                'uuid': 'fa4b1c66-ef79-11e5-87a0-0002b3a176b4',
                'sharedfolderref': '',
	def setUp(self):
		# Tell the database implementation to use the test database.
		openmediavault.setenv("OMV_CONFIG_FILE", "%s/../data/config.xml" %
			os.getcwd())