示例#1
0
    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()
示例#2
0
    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()
示例#3
0
    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()
示例#4
0
    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()
示例#5
0
 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()
示例#6
0
 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'])