Commit 73454d96 authored by Likun Zhang's avatar Likun Zhang
Browse files

Update the unittest code of xfrin.

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac289@2629 e5f2f494-b856-4b98-b285-d166d9295462
parent c029db4f
......@@ -430,11 +430,11 @@ class TestXfrin(unittest.TestCase):
self.assertEqual(master_addrinfo[4][0], TEST_MASTER_IPV6_ADDRESS)
def test_parse_cmd_params_chclass(self):
self.args['rrclass'] = 'CH'
self.args['zone_class'] = 'CH'
self.assertEqual(self._do_parse()[1], RRClass.CH())
def test_parse_cmd_params_bogusclass(self):
self.args['rrclass'] = 'XXX'
self.args['zone_class'] = 'XXX'
self.assertRaises(XfrinException, self._do_parse)
def test_parse_cmd_params_nozone(self):
......@@ -518,11 +518,32 @@ class TestXfrin(unittest.TestCase):
self.args['master'] = TEST_MASTER_IPV6_ADDRESS
# ...but right now we disable the feature due to security concerns.
self.assertEqual(self.xfr.command_handler("notify",
self.args)['result'][0], 1)
self.args)['result'][0], 0)
def test_command_handler_unknown(self):
self.assertEqual(self.xfr.command_handler("xxx", None)['result'][0], 1)
def test_command_handler_transfers_in(self):
self.assertEqual(self.xfr.config_handler({})['result'][0], 0)
self.assertEqual(self.xfr.config_handler({'transfers_in': 3})['result'][0], 0)
self.assertEqual(self.xfr._max_transfers_in, 3)
def test_command_handler_masters(self):
master_info = {'masters': {'address': '1.1.1.1', 'port':53} }
self.assertEqual(self.xfr.config_handler(master_info)['result'][0], 0)
master_info = {'masters': {'address': '1111.1.1.1', 'port':53 } }
self.assertEqual(self.xfr.config_handler(master_info)['result'][0], 1)
master_info = {'masters': {'address': '2.2.2.2', 'port':530000 } }
self.assertEqual(self.xfr.config_handler(master_info)['result'][0], 1)
master_info = {'masters': {'address': '2.2.2.2', 'port':53 } }
self.xfr.config_handler(master_info)
self.assertEqual(self.xfr._masters['address'], '2.2.2.2')
self.assertEqual(self.xfr._masters['port'], 53)
def raise_interrupt():
raise KeyboardInterrupt()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment