BIND 10 trac2254, updated. 9b730d026d634dbefdc50eea9d63df77201e30f4 [2254] cleanups
BIND 10 source code commits
bind10-changes at lists.isc.org
Sun Sep 30 10:21:11 UTC 2012
The branch, trac2254 has been updated
via 9b730d026d634dbefdc50eea9d63df77201e30f4 (commit)
via 6bd433b573a427c85cbbd7c75dd1bb08f672d678 (commit)
from 96da4b2e1aa8c82b1f33103a89d7bd8be8ca390b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9b730d026d634dbefdc50eea9d63df77201e30f4
Author: Jelte Jansen <jelte at isc.org>
Date: Fri Sep 28 16:49:01 2012 +0200
[2254] cleanups
- rename BindCmdParse to BindCmdParser
- rename 'cmd' in tests to 'cmd_parser' (if used as BindCmdParser)
- cut off long lines according to style guide
commit 6bd433b573a427c85cbbd7c75dd1bb08f672d678
Author: Jelte Jansen <jelte at isc.org>
Date: Fri Sep 28 16:29:42 2012 +0200
[2254] more review comments; code cleanup and docs
removed self.location magic because config go is mostly broken now anyway
added docstring description for complete()
-----------------------------------------------------------------------
Summary of changes:
src/bin/bindctl/bindcmd.py | 75 ++++++++++---
src/bin/bindctl/cmdparse.py | 36 +++----
src/bin/bindctl/tests/bindctl_test.py | 188 ++++++++++++++++++++-------------
3 files changed, 188 insertions(+), 111 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/bindctl/bindcmd.py b/src/bin/bindctl/bindcmd.py
index 5ba8a51..d4cab7c 100644
--- a/src/bin/bindctl/bindcmd.py
+++ b/src/bin/bindctl/bindcmd.py
@@ -22,7 +22,7 @@ import sys
from cmd import Cmd
from bindctl.exception import *
from bindctl.moduleinfo import *
-from bindctl.cmdparse import BindCmdParse
+from bindctl.cmdparse import BindCmdParser
from bindctl import command_sets
from xml.dom import minidom
import isc
@@ -48,8 +48,11 @@ except ImportError:
# if we have readline support, use that, otherwise use normal stdio
try:
import readline
- # Only consider whitespace as word boundaries
- readline.set_completer_delims(' \t\n')
+ # Only consider spaces as word boundaries; identifiers can contain
+ # '/' and '[]', and configuration item names can in theory use any
+ # printable character. See the discussion in tickets #1345 and
+ # #2254 for more information.
+ readline.set_completer_delims(' ')
my_readline = readline.get_line_buffer
except ImportError:
@@ -463,11 +466,21 @@ class BindCmdInterpreter(Cmd):
def _get_identifier_startswith(self, id_text):
"""Return the tab-completion hints for identifiers starting with
- id_text"""
- # First get all items from the given module (up to the first /)
+ id_text.
+
+ Parameters:
+ id_text (string): the currently entered identifier part, which
+ is to be completed.
+ """
+ # Strip starting "/" from id_text
+ if id_text.startswith('/'):
+ id_text = id_text[1:]
+ # Get all items from the given module (up to the first /)
list = self.config_data.get_config_item_list(
- id_text.rpartition("/")[0], True)
- hints = [val for val in list if val.startswith(id_text[1:])]
+ id_text.rpartition("/")[0], recurse=True)
+ # filter out all possibilities that don't match currently entered
+ # text part
+ hints = [val for val in list if val.startswith(id_text)]
return hints
def _cmd_has_identifier_param(self, cmd):
@@ -476,7 +489,7 @@ class BindCmdInterpreter(Cmd):
parameter which points to a config data identifier
Parameters:
- cmd (cmdparse.BindCmdParse): command context, including given params
+ cmd (cmdparse.BindCmdParser): command context, including given params
"""
if cmd.module not in self.modules:
@@ -485,24 +498,52 @@ class BindCmdInterpreter(Cmd):
return command.has_param_with_name(IDENTIFIER_PARAM)
def complete(self, text, state):
+ """
+ Returns tab-completion hints. See the python documentation of the
+ readline and Cmd modules for more information.
+
+ The first time this is called (within one 'completer' action), it
+ has state 0, and a list of possible completions is made. This list
+ is stored; complete() will then be called with increasing values of
+ state, until it returns None. For each call it returns the state'th
+ element of the hints it collected in the first call.
+
+ The hints list contents depend on which part of the full command
+ line; if no module is given yet, it will list all modules. If a
+ module is given, but no command, it will complete with module
+ commands. If both have been given, it will create the hints based on
+ the command parameters.
+
+ If module and command have already been specified, and the command
+ has a parameter 'identifier', the configuration data is used to
+ create the hints list.
+
+ Parameters:
+ text (string): The text entered so far in the 'current' part of
+ the command (module, command, parameters)
+ state (int): state used in the readline tab-completion logic;
+ 0 on first call, increasing by one until there are
+ no (more) hints to return.
+
+ Returns the string value of the hints list with index 'state',
+ or None if no (more) hints are available.
+ """
if 0 == state:
self._update_all_modules_info()
text = text.strip()
hints = []
cur_line = my_readline()
try:
- cmd = BindCmdParse(cur_line)
+ cmd = BindCmdParser(cur_line)
if not cmd.params and text:
hints = self._get_command_startswith(cmd.module, text)
+ elif self._cmd_has_identifier_param(cmd):
+ # For tab-completion of identifiers, replace hardcoded
+ # hints with hints derived from the config data
+ hints = self._get_identifier_startswith(text)
else:
hints = self._get_param_startswith(cmd.module, cmd.command,
text)
- if self._cmd_has_identifier_param(cmd):
- # For tab-completion of identifiers, replace hardcoded
- # hints with hints derived from the config data
- id_text = self.location + "/" +\
- cur_line.rpartition(" ")[2]
- hints = self._get_identifier_startswith(id_text)
except CmdModuleNameFormatError:
if not text:
@@ -568,7 +609,7 @@ class BindCmdInterpreter(Cmd):
def _parse_cmd(self, line):
try:
- cmd = BindCmdParse(line)
+ cmd = BindCmdParser(line)
self._validate_cmd(cmd)
self._handle_cmd(cmd)
except (IOError, http.client.HTTPException) as err:
@@ -800,7 +841,7 @@ class BindCmdInterpreter(Cmd):
else:
print("Warning: ignoring unknown directive: " + line)
else:
- cmd = BindCmdParse(line)
+ cmd = BindCmdParser(line)
self._validate_cmd(cmd)
self._handle_cmd(cmd)
except (isc.config.ModuleCCSessionError,
diff --git a/src/bin/bindctl/cmdparse.py b/src/bin/bindctl/cmdparse.py
index c624cba..30909a3 100644
--- a/src/bin/bindctl/cmdparse.py
+++ b/src/bin/bindctl/cmdparse.py
@@ -25,7 +25,7 @@ except ImportError:
param_name_str = "^\s*(?P<param_name>[\w]+)\s*=\s*"
-# The value string can be a sequence without space or comma
+# The value string can be a sequence without space or comma
# characters, or a string surroundedby quotation marks(such marks
# can be part of string in an escaped form)
#param_value_str = "(?P<param_value>[\"\'].+?(?<!\\\)[\"\']|[^\'\"][^, ]+)"
@@ -34,8 +34,8 @@ param_value_with_quota_str = "[\"\'](?P<param_value>.+?)(?<!\\\)[\"\']"
next_params_str = "(?P<blank>\s*)(?P<comma>,?)(?P<next_params>.*)$"
-PARAM_WITH_QUOTA_PATTERN = re.compile(param_name_str +
- param_value_with_quota_str +
+PARAM_WITH_QUOTA_PATTERN = re.compile(param_name_str +
+ param_value_with_quota_str +
next_params_str)
PARAM_PATTERN = re.compile(param_name_str + param_value_str + next_params_str)
# Used for module and command name
@@ -83,52 +83,52 @@ def _remove_list_and_map_whitespace(text):
if map_count == 0:
result.append(_remove_unquoted_whitespace(text[cur_start_map_pos:pos + 1]))
start_pos = pos + 1
-
+
pos = pos + 1
if start_pos <= len(text):
result.append(text[start_pos:len(text)])
return "".join(result)
-
-
-class BindCmdParse:
+
+
+class BindCmdParser:
""" This class will parse the command line user input into three parts:
module name, command, parameters
- the first two parts are strings and parameter is one hash,
+ the first two parts are strings and parameter is one hash,
parameters part is optional
-
- Example: zone reload, zone_name=example.com
+
+ Example: zone reload, zone_name=example.com
module == zone
command == reload
params == [zone_name = 'example.com']
"""
-
+
def __init__(self, cmd):
self.params = OrderedDict()
self.module = ''
self.command = ''
self._parse_cmd(cmd)
- def _parse_cmd(self, text_str):
+ def _parse_cmd(self, text_str):
'''Parse command line. '''
# Get module name
groups = NAME_PATTERN.match(text_str)
if not groups:
raise CmdModuleNameFormatError
-
+
self.module = groups.group('name')
cmd_str = groups.group('others')
if cmd_str:
if not groups.group('blank'):
raise CmdModuleNameFormatError
- else:
+ else:
raise CmdMissCommandNameFormatError(self.module)
-
+
# Get command name
groups = NAME_PATTERN.match(cmd_str)
if (not groups):
raise CmdCommandNameFormatError(self.module)
-
+
self.command = groups.group('name')
param_str = groups.group('others')
if param_str:
@@ -143,7 +143,7 @@ class BindCmdParse:
def _parse_params(self, param_text):
"""convert a=b,c=d into one hash """
param_text = _remove_list_and_map_whitespace(param_text)
-
+
# Check parameter name "help"
param = NAME_PATTERN.match(param_text)
if param and param.group('name') == "help":
@@ -153,7 +153,7 @@ class BindCmdParse:
while True:
if not param_text.strip():
break
-
+
groups = PARAM_PATTERN.match(param_text) or \
PARAM_WITH_QUOTA_PATTERN.match(param_text)
if not groups:
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index 1b2aae6..8d6b668 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -40,14 +40,14 @@ except ImportError:
class TestCmdLex(unittest.TestCase):
def my_assert_raise(self, exception_type, cmd_line):
- self.assertRaises(exception_type, cmdparse.BindCmdParse, cmd_line)
+ self.assertRaises(exception_type, cmdparse.BindCmdParser, cmd_line)
def testCommandWithoutParameter(self):
- cmd = cmdparse.BindCmdParse("zone add")
- assert cmd.module == "zone"
- assert cmd.command == "add"
- self.assertEqual(len(cmd.params), 0)
+ cmd_parser = cmdparse.BindCmdParser("zone add")
+ assert cmd_parser.module == "zone"
+ assert cmd_parser.command == "add"
+ self.assertEqual(len(cmd_parser.params), 0)
def testCommandWithParameters(self):
@@ -56,45 +56,51 @@ class TestCmdLex(unittest.TestCase):
"zone add zone_name = 'cnnic.cn\", file ='cnnic.cn.file' master=1.1.1.1, " }
for cmd_line in lines:
- cmd = cmdparse.BindCmdParse(cmd_line)
- assert cmd.module == "zone"
- assert cmd.command == "add"
- assert cmd.params["zone_name"] == "cnnic.cn"
- assert cmd.params["file"] == "cnnic.cn.file"
- assert cmd.params["master"] == '1.1.1.1'
+ cmd_parser = cmdparse.BindCmdParser(cmd_line)
+ assert cmd_parser.module == "zone"
+ assert cmd_parser.command == "add"
+ assert cmd_parser.params["zone_name"] == "cnnic.cn"
+ assert cmd_parser.params["file"] == "cnnic.cn.file"
+ assert cmd_parser.params["master"] == '1.1.1.1'
def testCommandWithParamters_2(self):
'''Test whether the parameters in key=value can be parsed properly.'''
- cmd = cmdparse.BindCmdParse('zone cmd name = 1:34::2')
- self.assertEqual(cmd.params['name'], '1:34::2')
-
- cmd = cmdparse.BindCmdParse('zone cmd name = 1\"\'34**&2 value=44\"\'\"')
- self.assertEqual(cmd.params['name'], '1\"\'34**&2')
- self.assertEqual(cmd.params['value'], '44\"\'\"')
-
- cmd = cmdparse.BindCmdParse('zone cmd name = 1\"\'34**&2 ,value= 44\"\'\"')
- self.assertEqual(cmd.params['name'], '1\"\'34**&2')
- self.assertEqual(cmd.params['value'], '44\"\'\"')
-
- cmd = cmdparse.BindCmdParse('zone cmd name = 1\'34**&2value=44\"\'\" value = \"==============\'')
- self.assertEqual(cmd.params['name'], '1\'34**&2value=44\"\'\"')
- self.assertEqual(cmd.params['value'], '==============')
-
- cmd = cmdparse.BindCmdParse('zone cmd name = \"1234, 567890 \" value ==&*/')
- self.assertEqual(cmd.params['name'], '1234, 567890 ')
- self.assertEqual(cmd.params['value'], '=&*/')
+ cmd_parser = cmdparse.BindCmdParser('zone cmd name = 1:34::2')
+ self.assertEqual(cmd_parser.params['name'], '1:34::2')
+
+ cmd_parser = cmdparse.BindCmdParser('zone cmd name = 1\"\'34**&2'
+ ' value=44\"\'\"')
+ self.assertEqual(cmd_parser.params['name'], '1\"\'34**&2')
+ self.assertEqual(cmd_parser.params['value'], '44\"\'\"')
+
+ cmd_parser = cmdparse.BindCmdParser('zone cmd name = 1\"\'34**&2'
+ ',value= 44\"\'\"')
+ self.assertEqual(cmd_parser.params['name'], '1\"\'34**&2')
+ self.assertEqual(cmd_parser.params['value'], '44\"\'\"')
+
+ cmd_parser = cmdparse.BindCmdParser('zone cmd name = 1\'34**&2'
+ 'value=44\"\'\" value = '
+ '\"==============\'')
+ self.assertEqual(cmd_parser.params['name'], '1\'34**&2value=44\"\'\"')
+ self.assertEqual(cmd_parser.params['value'], '==============')
+
+ cmd_parser = cmdparse.BindCmdParser('zone cmd name = \"1234, '
+ '567890 \" value ==&*/')
+ self.assertEqual(cmd_parser.params['name'], '1234, 567890 ')
+ self.assertEqual(cmd_parser.params['value'], '=&*/')
def testCommandWithListParam(self):
- cmd = cmdparse.BindCmdParse("zone set zone_name='cnnic.cn', master='1.1.1.1, 2.2.2.2'")
- assert cmd.params["master"] == '1.1.1.1, 2.2.2.2'
+ cmd_parser = cmdparse.BindCmdParser("zone set zone_name='cnnic.cn', "
+ "master='1.1.1.1, 2.2.2.2'")
+ assert cmd_parser.params["master"] == '1.1.1.1, 2.2.2.2'
def testCommandWithHelpParam(self):
- cmd = cmdparse.BindCmdParse("zone add help")
- assert cmd.params["help"] == "help"
+ cmd_parser = cmdparse.BindCmdParser("zone add help")
+ assert cmd_parser.params["help"] == "help"
- cmd = cmdparse.BindCmdParse("zone add help *&)&)*&&$#$^%")
- assert cmd.params["help"] == "help"
- self.assertEqual(len(cmd.params), 1)
+ cmd_parser = cmdparse.BindCmdParser("zone add help *&)&)*&&$#$^%")
+ assert cmd_parser.params["help"] == "help"
+ self.assertEqual(len(cmd_parser.params), 1)
def testCmdModuleNameFormatError(self):
@@ -130,15 +136,20 @@ class TestCmdSyntax(unittest.TestCase):
int_spec = { 'item_type' : 'integer',
'item_optional' : False,
'item_default' : 10}
- zone_file_param = ParamInfo(name = "zone_file", param_spec = string_spec)
+ zone_file_param = ParamInfo(name = "zone_file",
+ param_spec = string_spec)
zone_name = ParamInfo(name = 'zone_name', param_spec = string_spec)
load_cmd = CommandInfo(name = "load")
load_cmd.add_param(zone_file_param)
load_cmd.add_param(zone_name)
- param_master = ParamInfo(name = "master", optional = True, param_spec = string_spec)
- param_master = ParamInfo(name = "port", optional = True, param_spec = int_spec)
- param_allow_update = ParamInfo(name = "allow_update", optional = True, param_spec = string_spec)
+ param_master = ParamInfo(name = "master", optional = True,
+ param_spec = string_spec)
+ param_master = ParamInfo(name = "port", optional = True,
+ param_spec = int_spec)
+ param_allow_update = ParamInfo(name = "allow_update",
+ optional = True,
+ param_spec = string_spec)
set_cmd = CommandInfo(name = "set")
set_cmd.add_param(param_master)
set_cmd.add_param(param_allow_update)
@@ -160,13 +171,14 @@ class TestCmdSyntax(unittest.TestCase):
def no_assert_raise(self, cmd_line):
- cmd = cmdparse.BindCmdParse(cmd_line)
- self.bindcmd._validate_cmd(cmd)
+ cmd_parser = cmdparse.BindCmdParser(cmd_line)
+ self.bindcmd._validate_cmd(cmd_parser)
def my_assert_raise(self, exception_type, cmd_line):
- cmd = cmdparse.BindCmdParse(cmd_line)
- self.assertRaises(exception_type, self.bindcmd._validate_cmd, cmd)
+ cmd_parser = cmdparse.BindCmdParser(cmd_line)
+ self.assertRaises(exception_type, self.bindcmd._validate_cmd,
+ cmd_parser)
def testValidateSuccess(self):
@@ -177,7 +189,8 @@ class TestCmdSyntax(unittest.TestCase):
self.no_assert_raise("zone help help='dd' ")
self.no_assert_raise("zone set allow_update='1.1.1.1' zone_name='cn'")
self.no_assert_raise("zone set zone_name='cn'")
- self.my_assert_raise(isc.cc.data.DataTypeError, "zone set zone_name ='cn', port='cn'")
+ self.my_assert_raise(isc.cc.data.DataTypeError,
+ "zone set zone_name ='cn', port='cn'")
self.no_assert_raise("zone reload_all")
def testCmdUnknownModuleSyntaxError(self):
@@ -188,15 +201,22 @@ class TestCmdSyntax(unittest.TestCase):
self.my_assert_raise(CmdUnknownCmdSyntaxError, "zone dd")
def testCmdMissParamSyntaxError(self):
- self.my_assert_raise(CmdMissParamSyntaxError, "zone load zone_file='cn'")
- self.my_assert_raise(CmdMissParamSyntaxError, "zone load zone_name='cn'")
- self.my_assert_raise(CmdMissParamSyntaxError, "zone set allow_update='1.1.1.1'")
- self.my_assert_raise(CmdMissParamSyntaxError, "zone set ")
+ self.my_assert_raise(CmdMissParamSyntaxError,
+ "zone load zone_file='cn'")
+ self.my_assert_raise(CmdMissParamSyntaxError,
+ "zone load zone_name='cn'")
+ self.my_assert_raise(CmdMissParamSyntaxError,
+ "zone set allow_update='1.1.1.1'")
+ self.my_assert_raise(CmdMissParamSyntaxError,
+ "zone set ")
def testCmdUnknownParamSyntaxError(self):
- self.my_assert_raise(CmdUnknownParamSyntaxError, "zone load zone_d='cn'")
- self.my_assert_raise(CmdUnknownParamSyntaxError, "zone reload_all zone_name = 'cn'")
- self.my_assert_raise(CmdUnknownParamSyntaxError, "zone help a b c")
+ self.my_assert_raise(CmdUnknownParamSyntaxError,
+ "zone load zone_d='cn'")
+ self.my_assert_raise(CmdUnknownParamSyntaxError,
+ "zone reload_all zone_name = 'cn'")
+ self.my_assert_raise(CmdUnknownParamSyntaxError,
+ "zone help a b c")
class TestModuleInfo(unittest.TestCase):
@@ -233,7 +253,8 @@ class TestNameSequence(unittest.TestCase):
self.tool.add_module_info(ModuleInfo(name = random_str))
def setUp(self):
- self.random_names = ['1erdfeDDWsd', '3fe', '2009erd', 'Fe231', 'tere142', 'rei8WD']
+ self.random_names = ['1erdfeDDWsd', '3fe', '2009erd',
+ 'Fe231', 'tere142', 'rei8WD']
self._create_bindcmd()
def testSequence(self):
@@ -321,7 +342,8 @@ class TestConfigCommands(unittest.TestCase):
def precmd(line):
self.tool.precmd(line)
self.tool._update_all_modules_info = update_all_modules_info
- # If line is equals to 'EOF', _update_all_modules_info() shouldn't be called
+ # If line is equals to 'EOF', _update_all_modules_info()
+ # shouldn't be called
precmd('EOF')
self.assertRaises(socket.error, precmd, 'continue')
@@ -360,34 +382,41 @@ class TestConfigCommands(unittest.TestCase):
self.assertEqual((1, MultiConfigData.DEFAULT),
self.tool.config_data.get_value("/foo/an_int"))
- cmd = cmdparse.BindCmdParse("config set identifier=\"foo/an_int\" value=\"5\"")
- self.tool.apply_config_cmd(cmd)
+ cmd_parser = cmdparse.BindCmdParser('config set identifier='
+ '"foo/an_int" value="5"')
+ self.tool.apply_config_cmd(cmd_parser)
self.assertEqual((5, MultiConfigData.LOCAL),
self.tool.config_data.get_value("/foo/an_int"))
- cmd = cmdparse.BindCmdParse("config unset identifier=\"foo/an_int\"")
- self.tool.apply_config_cmd(cmd)
+ cmd_parser = cmdparse.BindCmdParser('config unset identifier='
+ '"foo/an_int"')
+ self.tool.apply_config_cmd(cmd_parser)
self.assertEqual((1, MultiConfigData.DEFAULT),
self.tool.config_data.get_value("/foo/an_int"))
# this should raise a NotFoundError
- cmd = cmdparse.BindCmdParse("config set identifier=\"foo/bar\" value=\"[]\"")
- self.assertRaises(isc.cc.data.DataNotFoundError, self.tool.apply_config_cmd, cmd)
+ cmd_parser = cmdparse.BindCmdParser('config set identifier='
+ '"foo/bar" value="[]"')
+ self.assertRaises(isc.cc.data.DataNotFoundError,
+ self.tool.apply_config_cmd, cmd_parser)
- cmd = cmdparse.BindCmdParse("config unset identifier=\"foo/bar\"")
+ cmd_parser = cmdparse.BindCmdParser('config unset identifier='
+ '"foo/bar"')
self.assertRaises(isc.cc.data.DataNotFoundError,
- self.tool.apply_config_cmd, cmd)
+ self.tool.apply_config_cmd, cmd_parser)
# this should raise a TypeError
- cmd = cmdparse.BindCmdParse("config set identifier=\"foo/an_int\" value=\"[]\"")
- self.assertRaises(isc.cc.data.DataTypeError, self.tool.apply_config_cmd, cmd)
+ cmd_parser = cmdparse.BindCmdParser('config set identifier='
+ '"foo/an_int" value="[]"')
+ self.assertRaises(isc.cc.data.DataTypeError,
+ self.tool.apply_config_cmd, cmd_parser)
# this is a very specific one for use with a set of list tests
# to try out the flexibility of the parser (only in the next test)
def clt(self, full_cmd_string, item_value):
- cmd = cmdparse.BindCmdParse(full_cmd_string)
- self.tool.apply_config_cmd(cmd)
+ cmd_parser = cmdparse.BindCmdParser(full_cmd_string)
+ self.tool.apply_config_cmd(cmd_parser)
self.assertEqual(([item_value], MultiConfigData.LOCAL),
self.tool.config_data.get_value("/foo/a_list"))
@@ -410,11 +439,15 @@ class TestConfigCommands(unittest.TestCase):
self.clt("config set identifier = \"foo/a_list\" value=[ \"k\" ]", "k")
# this should raise a TypeError
- cmd = cmdparse.BindCmdParse("config set identifier=\"foo/a_list\" value=\"a\"")
- self.assertRaises(isc.cc.data.DataTypeError, self.tool.apply_config_cmd, cmd)
+ cmd_parser = cmdparse.BindCmdParser('config set identifier='
+ '"foo/a_list" value="a"')
+ self.assertRaises(isc.cc.data.DataTypeError,
+ self.tool.apply_config_cmd, cmd_parser)
- cmd = cmdparse.BindCmdParse("config set identifier=\"foo/a_list\" value=[1]")
- self.assertRaises(isc.cc.data.DataTypeError, self.tool.apply_config_cmd, cmd)
+ cmd_parser = cmdparse.BindCmdParser('config set identifier='
+ '"foo/a_list" value=[1]')
+ self.assertRaises(isc.cc.data.DataTypeError,
+ self.tool.apply_config_cmd, cmd_parser)
def tearDown(self):
sys.stdout = self.stdout_backup
@@ -434,14 +467,17 @@ class TestConfigCommands(unittest.TestCase):
self.tool.add_module_info(module)
- cmd = cmdparse.BindCmdParse("test_module command_with_identifier")
- self.assertTrue(self.tool._cmd_has_identifier_param(cmd))
+ cmd_parser = cmdparse.BindCmdParser('test_module '
+ 'command_with_identifier')
+ self.assertTrue(self.tool._cmd_has_identifier_param(cmd_parser))
- cmd = cmdparse.BindCmdParse("test_module command_without_identifier")
- self.assertFalse(self.tool._cmd_has_identifier_param(cmd))
+ cmd_parser = cmdparse.BindCmdParser('test_module '
+ 'command_without_identifier')
+ self.assertFalse(self.tool._cmd_has_identifier_param(cmd_parser))
- cmd = cmdparse.BindCmdParse("badmodule command_without_identifier")
- self.assertFalse(self.tool._cmd_has_identifier_param(cmd))
+ cmd_parser = cmdparse.BindCmdParser('badmodule '
+ 'command_without_identifier')
+ self.assertFalse(self.tool._cmd_has_identifier_param(cmd_parser))
def test_get_identifier_startswith(self):
hints = self.tool._get_identifier_startswith("/")
More information about the bind10-changes
mailing list