diff --git a/vlanmang.py b/vlanmang.py index 81bca95..23a5626 100644 --- a/vlanmang.py +++ b/vlanmang.py @@ -531,7 +531,31 @@ class _TestMisc(unittest.TestCase): self.assertEqual(set(res), set(validres)) -_skipSwitchTests = False +class _TestSNMPSwitch(unittest.TestCase): + def test_splitmany(self): + # make sure that if we get a tooBig error that we split the + # _getmany request + + switch = SNMPSwitch(None, None) + + @mock.patch('vlanmang.SNMPSwitch._getmany') + def test_get(self, gm): + # that a switch + switch = SNMPSwitch(None, None) + + # when _getmany returns this structure + retval = object() + gm.side_effect = [[[ None, retval ]]] + + arg = object() + + # will return the correct value + self.assertIs(switch._get(arg), retval) + + # and call _getmany w/ the correct arg + gm.assert_called_with(arg) + +_skipSwitchTests = True class _TestSwitch(unittest.TestCase): def setUp(self):