예제 #1
0
    def test_context(self):
        lock = locking.InternalLock(self.node.uuid)
        lock._lock = self.mock_lock

        with lock:
            self.mock_lock.acquire.assert_called_once_with()

        self.mock_lock.release.assert_called_once_with()
예제 #2
0
 def test_acquire(self):
     lock = locking.InternalLock(self.node.uuid)
     lock._lock = self.mock_lock
     lock.acquire()
     self.mock_lock.acquire.assert_called_once_with(blocking=True)
예제 #3
0
 def test_init_lock(self, mock_lockutils):
     locking.InternalLock(self.node.uuid)
     mock_lockutils.internal_lock.assert_called_with(
         'node-%s' % self.node.uuid, mock.ANY)