Browse Source

add some basic tests for SNMPSwitch that don't depend upon hardware...

ssh-lenovo
John-Mark Gurney 5 years ago
parent
commit
edeb98568b
1 changed files with 25 additions and 1 deletions
  1. +25
    -1
      vlanmang.py

+ 25
- 1
vlanmang.py View File

@@ -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):


Loading…
Cancel
Save