Browse Source

make sure that when the board is released, power is turned off...

main
John-Mark Gurney 4 years ago
parent
commit
d157861f1e
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      bitelab/snmp.py

+ 11
- 0
bitelab/snmp.py View File

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

Loading…
Cancel
Save