Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.31
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
certbot /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
display
[ DIR ]
drwxr-xr-x
testdata
[ DIR ]
drwxr-xr-x
__init__.py
20
B
-rw-r--r--
account_test.py
14.45
KB
-rw-r--r--
acme_util.py
3.18
KB
-rw-r--r--
auth_handler_test.py
24
KB
-rw-r--r--
cert_manager_test.py
28.07
KB
-rw-r--r--
cli_test.py
19.94
KB
-rw-r--r--
client_test.py
28.76
KB
-rw-r--r--
compat_test.py
736
B
-rw-r--r--
configuration_test.py
6.82
KB
-rw-r--r--
crypto_util_test.py
13.56
KB
-rw-r--r--
eff_test.py
5.94
KB
-rw-r--r--
error_handler_test.py
5.31
KB
-rw-r--r--
errors_test.py
1.8
KB
-rw-r--r--
hook_test.py
16.67
KB
-rw-r--r--
lock_test.py
3.84
KB
-rw-r--r--
log_test.py
14.95
KB
-rw-r--r--
main_test.py
82.52
KB
-rw-r--r--
notify_test.py
2.07
KB
-rw-r--r--
ocsp_test.py
6.27
KB
-rw-r--r--
renewal_test.py
4.18
KB
-rw-r--r--
renewupdater_test.py
5.32
KB
-rw-r--r--
reporter_test.py
2.73
KB
-rw-r--r--
reverter_test.py
18.7
KB
-rw-r--r--
storage_test.py
42.89
KB
-rw-r--r--
util.py
14.12
KB
-rw-r--r--
util_test.py
21.58
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : lock_test.py
"""Tests for certbot.lock.""" import functools import multiprocessing import os import unittest import mock from certbot import errors from certbot.tests import util as test_util @test_util.broken_on_windows class LockDirTest(test_util.TempDirTestCase): """Tests for certbot.lock.lock_dir.""" @classmethod def _call(cls, *args, **kwargs): from certbot.lock import lock_dir return lock_dir(*args, **kwargs) def test_it(self): assert_raises = functools.partial( self.assertRaises, errors.LockError, self._call, self.tempdir) lock_path = os.path.join(self.tempdir, '.certbot.lock') test_util.lock_and_call(assert_raises, lock_path) @test_util.broken_on_windows class LockFileTest(test_util.TempDirTestCase): """Tests for certbot.lock.LockFile.""" @classmethod def _call(cls, *args, **kwargs): from certbot.lock import LockFile return LockFile(*args, **kwargs) def setUp(self): super(LockFileTest, self).setUp() self.lock_path = os.path.join(self.tempdir, 'test.lock') def test_acquire_without_deletion(self): # acquire the lock in another process but don't delete the file child = multiprocessing.Process(target=self._call, args=(self.lock_path,)) child.start() child.join() self.assertEqual(child.exitcode, 0) self.assertTrue(os.path.exists(self.lock_path)) # Test we're still able to properly acquire and release the lock self.test_removed() def test_contention(self): assert_raises = functools.partial( self.assertRaises, errors.LockError, self._call, self.lock_path) test_util.lock_and_call(assert_raises, self.lock_path) def test_locked_repr(self): lock_file = self._call(self.lock_path) locked_repr = repr(lock_file) self._test_repr_common(lock_file, locked_repr) self.assertTrue('acquired' in locked_repr) def test_released_repr(self): lock_file = self._call(self.lock_path) lock_file.release() released_repr = repr(lock_file) self._test_repr_common(lock_file, released_repr) self.assertTrue('released' in released_repr) def _test_repr_common(self, lock_file, lock_repr): self.assertTrue(lock_file.__class__.__name__ in lock_repr) self.assertTrue(self.lock_path in lock_repr) def test_race(self): should_delete = [True, False] stat = os.stat def delete_and_stat(path): """Wrap os.stat and maybe delete the file first.""" if path == self.lock_path and should_delete.pop(0): os.remove(path) return stat(path) with mock.patch('certbot.lock.os.stat') as mock_stat: mock_stat.side_effect = delete_and_stat self._call(self.lock_path) self.assertFalse(should_delete) def test_removed(self): lock_file = self._call(self.lock_path) lock_file.release() self.assertFalse(os.path.exists(self.lock_path)) @mock.patch('certbot.compat.fcntl.lockf') def test_unexpected_lockf_err(self, mock_lockf): msg = 'hi there' mock_lockf.side_effect = IOError(msg) try: self._call(self.lock_path) except IOError as err: self.assertTrue(msg in str(err)) else: # pragma: no cover self.fail('IOError not raised') @mock.patch('certbot.lock.os.stat') def test_unexpected_stat_err(self, mock_stat): msg = 'hi there' mock_stat.side_effect = OSError(msg) try: self._call(self.lock_path) except OSError as err: self.assertTrue(msg in str(err)) else: # pragma: no cover self.fail('OSError not raised') if __name__ == "__main__": unittest.main() # pragma: no cover
Close