diff --git a/bitelab/snmp.py b/bitelab/snmp.py index 9cd2063..32cba9e 100644 --- a/bitelab/snmp.py +++ b/bitelab/snmp.py @@ -89,6 +89,8 @@ class SNMPPower(Power): return await snmpset(self.host, 'pethPsePortAdminEnable.1.%d' % self.port, 'bool', v) + async def deactivate(self, brd): + return await self.setvalue(False) class TestSNMPWrapper(unittest.IsolatedAsyncioTestCase): @patch('asyncio.create_subprocess_exec') @@ -171,3 +173,12 @@ class TestSNMPPower(unittest.IsolatedAsyncioTestCase): # calls snmpset w/ the correct args ss.assert_called_with('host', 'pethPsePortAdminEnable.1.5', 'bool', True) + + ss.reset_mock() + + # that when deactivate is called + await sp.deactivate(None) + + # calls snmpset w/ the correct args + ss.assert_called_with('host', 'pethPsePortAdminEnable.1.5', + 'bool', False)