def test_lock_conflict_error(self): error = RPCError(etree.Element('lock-denied')) error._tag = 'lock-denied' self.device.connection.lock.side_effect = error with self.assertRaises(LockConflictError): self.device.lock()
def test_unlock_conflict_error(self): self.device._locked = True error = RPCError(etree.Element('operation-failed')) error._tag = 'operation-failed' error._message = 'Unlock Failed' self.device.connection.unlock.side_effect = error with self.assertRaises(UnlockConflictError): self.device.unlock()
def test_unlock_error(self): self.device._locked = True self.device.connection.unlock.side_effect = RPCError( etree.Element('error')) with self.assertRaises(NCError): self.device.unlock()
def test_execute_rpc_error(self): self.device.connection.cli_display.side_effect = RPCError( etree.Element('error')) with self.assertRaises(NCError): self.device.execute(self.device.connection.cli_display, ['display current'])