<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    certbot.tests.util module

    Test utilities.

    certbot.tests.util.``vector_path(*names)[source]
    Path to a test vector.

    certbot.tests.util.``load_vector(*names)[source]
    Load contents of a test vector.

    certbot.tests.util.``load_cert(*names)[source]
    Load certificate.

    certbot.tests.util.``load_csr(*names)[source]
    Load certificate request.

    certbot.tests.util.``load_comparable_csr(*names)[source]
    Load ComparableX509 certificate request.

    certbot.tests.util.``load_rsa_private_key(*names)[source]
    Load RSA private key.

    certbot.tests.util.``load_pyopenssl_private_key(*names)[source]
    Load pyOpenSSL private key.

    certbot.tests.util.``make_lineage(config_dir, testfile)[source]
    Creates a lineage defined by testfile.
    This creates the archive, live, and renewal directories if necessary and creates a simple lineage.
    Parameters:

    • config_dir (str) – path to the configuration directory
    • testfile (str) – configuration file to base the lineage on
      Returns: path to the renewal conf file for the created lineage
      Return type: str

    certbot.tests.util.``patch_get_utility(target=’zope.component.getUtility’)[source]
    Patch zope.component.getUtility to use a special mock IDisplay.
    The mock IDisplay works like a regular mock object, except it also also asserts that methods are called with valid arguments.
    Parameters: target (str) – path to patch
    Returns: mock zope.component.getUtility
    Return type: mock.MagicMock

    certbot.tests.util.``patch_get_utility_with_stdout(target=’zope.component.getUtility’, stdout=None)[source]
    Patch zope.component.getUtility to use a special mock IDisplay.
    The mock IDisplay works like a regular mock object, except it also also asserts that methods are called with valid arguments.
    The message argument passed to the IDisplay methods is passed to stdout’s write method.
    Parameters:

    • target (str) – path to patch
    • stdout (object) – object to write standard output to; it is expected to have a write method
      Returns: mock zope.component.getUtility
      Return type: mock.MagicMock

    classcertbot.tests.util.``FreezableMock(frozen=False, func=None, return_value=sentinel.DEFAULT)[source]
    Bases: object
    Mock object with the ability to freeze attributes.
    This class works like a regular mock.MagicMock object, except attributes and behavior set before the object is frozen cannot be changed during tests.
    If a func argument is provided to the constructor, this function is called first when an instance of FreezableMock is called, followed by the usual behavior defined by MagicMock. The return value of func is ignored.
    freeze()[source]
    Freeze object preventing further changes.

    classcertbot.tests.util.``TempDirTestCase(methodName=’runTest’)[source]
    Bases: unittest.case.TestCase
    Base test class which sets up and tears down a temporary directory
    setUp()[source]
    Execute before test
    tearDown()[source]
    Execute after test

    classcertbot.tests.util.``ConfigTestCase(methodName=’runTest’)[source]
    Bases: certbot.tests.util.TempDirTestCase
    Test class which sets up a NamespaceConfig object.
    setUp()[source]
    Execute before test

    certbot.tests.util.``lock_and_call(callback, path_to_lock)[source]
    Grab a lock on path_to_lock from a foreign process then execute the callback. :param callable callback: object to call after acquiring the lock :param str path_to_lock: path to file or directory to lock

    certbot.tests.util.``skip_on_windows(reason)[source]
    Decorator to skip permanently a test on Windows. A reason is required.

    certbot.tests.util.``temp_join(path)[source]
    Return the given path joined to the tempdir path for the current platform Eg.: ‘cert’ => /tmp/cert (Linux) or ‘C:UserscurrentuserAppDataTempcert’ (Windows)

    本文章首發在 網安wangan.com 網站上。

    上一篇 下一篇
    討論數量: 0
    只看當前版本


    暫無話題~
    亚洲 欧美 自拍 唯美 另类