2
0

test_config.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # test_config.py -- Tests for reading and writing configuration files
  2. # Copyright (C) 2011 Jelmer Vernooij <jelmer@samba.org>
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # or (at your option) a later version of the License.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. # MA 02110-1301, USA.
  18. """Tests for reading and writing configuraiton files."""
  19. from cStringIO import StringIO
  20. from dulwich.config import (
  21. ConfigFile,
  22. StackedConfig,
  23. )
  24. from dulwich.tests import TestCase
  25. class ConfigFileTests(TestCase):
  26. def from_file(self, text):
  27. return ConfigFile.from_file(StringIO(text))
  28. def test_empty(self):
  29. ConfigFile()
  30. def test_eq(self):
  31. self.assertEquals(ConfigFile(), ConfigFile())
  32. def test_from_file_empty(self):
  33. cf = self.from_file("")
  34. self.assertEquals(ConfigFile(), cf)
  35. class StackedConfigTests(TestCase):
  36. def test_default(self):
  37. StackedConfig.default()