From a97d21936200f1221d8ddd89202042faed1b9bcb Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 9 Dec 2009 21:38:12 +0100 Subject: config: fixed incorrect handling of default value in get_value remote.config: SectionConstraint now knows about set_value and get_value which are new to the GitConfigParser --- test/git/test_config.py | 4 ++++ test/git/test_remote.py | 1 + 2 files changed, 5 insertions(+) (limited to 'test') diff --git a/test/git/test_config.py b/test/git/test_config.py index 6103ab8d..407eb9bd 100644 --- a/test/git/test_config.py +++ b/test/git/test_config.py @@ -8,6 +8,7 @@ from test.testlib import * from git import * import StringIO from copy import copy +from ConfigParser import NoSectionError class TestBase(TestCase): @@ -97,4 +98,7 @@ class TestBase(TestCase): default = "my default value" assert r_config.get_value("doesnt", "exist", default) == default + # it raises if there is no default though + self.failUnlessRaises(NoSectionError, r_config.get_value, "doesnt", "exist") + diff --git a/test/git/test_remote.py b/test/git/test_remote.py index edbf758c..a9ca8331 100644 --- a/test/git/test_remote.py +++ b/test/git/test_remote.py @@ -358,6 +358,7 @@ class TestRemote(TestBase): val = getattr(remote, opt) reader = remote.config_reader assert reader.get(opt) == val + assert reader.get_value(opt, None) == val # unable to write with a reader self.failUnlessRaises(IOError, reader.set, opt, "test") -- cgit v1.2.1