@mock.patch('tempfile.tempdir', new='tmp')
@mock.patch('os.path.exists')
@mock.patch('os.close')
@mock.patch('os.remove')
def test_jlock_release_acquired(self, mock_remove, mock_close, mock_exists):
    'Tests releasing a held lock.\n\n        Args:\n          self (TestJLock): the ``TestJLock`` instance\n          mock_remove (Mock): mock file removal method\n          mock_close (Mock): mocked close method\n          mock_exists (Mock): mocked path exist method\n\n        Returns:\n          ``None``\n        '
    lock = jlock.JLock(3735928559)
    lock.acquired = True
    lock.fd = 1
    lock.path = os.sep
    self.assertTrue(lock.release())
    mock_exists.return_value = True
    mock_remove.assert_called_once_with(os.sep)
    mock_close.assert_called_once_with(1)
    mock_exists.assert_called_once_with(os.sep)
    self.assertEqual(False, lock.acquired)
Tests releasing a held lock.

Args:
  self (TestJLock): the ``TestJLock`` instance
  mock_remove (Mock): mock file removal method
  mock_close (Mock): mocked close method
  mock_exists (Mock): mocked path exist method

Returns:
  ``None``
@mock.patch('tempfile.tempdir', new='tmp')
@mock.patch('os.path.exists')
@mock.patch('os.close')
@mock.patch('os.remove')
def test_jlock_release_acquired(self, mock_remove, mock_close, mock_exists):
    'Tests releasing a held lock.\n\n        Args:\n          self (TestJLock): the ``TestJLock`` instance\n          mock_remove (Mock): mock file removal method\n          mock_close (Mock): mocked close method\n          mock_exists (Mock): mocked path exist method\n\n        Returns:\n          ``None``\n        '
    lock = jlock.JLock(3735928559)
    lock.acquired = True
    lock.fd = 1
    lock.path = os.sep
    self.assertTrue(lock.release())
    mock_exists.return_value = True
    mock_remove.assert_called_once_with(os.sep)
    mock_close.assert_called_once_with(1)
    mock_exists.assert_called_once_with(os.sep)
    self.assertEqual(False, lock.acquired)