New config test case with fix
This commit is contained in:
+2
-2
@@ -14,10 +14,10 @@ class MilterConfigParser(ConfigParser):
|
|||||||
# which screws up iterating over all options in a section.
|
# which screws up iterating over all options in a section.
|
||||||
# Worse, passing "defaults" with vars= overrides the config file!
|
# Worse, passing "defaults" with vars= overrides the config file!
|
||||||
# So we roll our own defaults.
|
# So we roll our own defaults.
|
||||||
def get(self,sect,opt,raw=False,fallback=None):
|
def get(self,sect,opt,fallback=None,**kwds):
|
||||||
if not self.has_option(sect,opt) and not fallback and opt in self.defaults:
|
if not self.has_option(sect,opt) and not fallback and opt in self.defaults:
|
||||||
return self.defaults[opt]
|
return self.defaults[opt]
|
||||||
return ConfigParser.get(self,sect,opt,raw=raw,fallback=fallback)
|
return ConfigParser.get(self,sect,opt,fallback=fallback,**kwds)
|
||||||
|
|
||||||
def getlist(self,sect,opt):
|
def getlist(self,sect,opt):
|
||||||
if self.has_option(sect,opt):
|
if self.has_option(sect,opt):
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ class ConfigTestCase(unittest.TestCase):
|
|||||||
socketname = cp.getdefault('srsmilter','socketname',
|
socketname = cp.getdefault('srsmilter','socketname',
|
||||||
'/var/run/milter/srsmilter')
|
'/var/run/milter/srsmilter')
|
||||||
self.assertEqual(socketname,'/var/run/milter/srsmilter')
|
self.assertEqual(socketname,'/var/run/milter/srsmilter')
|
||||||
|
miltersrs = cp.getboolean('srsmilter','miltersrs')
|
||||||
|
self.assertFalse(miltersrs)
|
||||||
|
|
||||||
def suite(): return unittest.makeSuite(ConfigTestCase,'test')
|
def suite(): return unittest.makeSuite(ConfigTestCase,'test')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user