"""Base test class for DNS authenticators.""" import configobj import josepy as jose import mock import six from acme import challenges from certbot import achallenges from certbot.compat import filesystem from certbot.tests import acme_util from certbot.tests import util as test_util DOMAIN = 'example.com' KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem")) class BaseAuthenticatorTest(object): """ A base test class to reduce duplication between test code for DNS Authenticator Plugins. Assumes: * That subclasses also subclass unittest.TestCase * That the authenticator is stored as self.auth """ achall = achallenges.KeyAuthorizationAnnotatedChallenge( challb=acme_util.DNS01, domain=DOMAIN, account_key=KEY) def test_more_info(self): # pylint: disable=no-member self.assertTrue(isinstance(self.auth.more_info(), six.string_types)) def test_get_chall_pref(self): # pylint: disable=no-member self.assertEqual(self.auth.get_chall_pref(None), [challenges.DNS01]) def test_parser_arguments(self): m = mock.MagicMock() # pylint: disable=no-member self.auth.add_parser_arguments(m) m.assert_any_call('propagation-seconds', type=int, default=mock.ANY, help=mock.ANY) def write(values, path): """Write the specified values to a config file. :param dict values: A map of values to write. :param str path: Where to write the values. """ config = configobj.ConfigObj() for key in values: config[key] = values[key] with open(path, "wb") as f: config.write(outfile=f) filesystem.chmod(path, 0o600)
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 30 B | 0644 |
|
common.py | File | 18.68 KB | 0644 |
|
common_test.py | File | 14.89 KB | 0644 |
|
disco.py | File | 9.96 KB | 0644 |
|
disco_test.py | File | 11.34 KB | 0644 |
|
dns_common.py | File | 11.69 KB | 0644 |
|
dns_common_lexicon.py | File | 5.41 KB | 0644 |
|
dns_common_lexicon_test.py | File | 651 B | 0644 |
|
dns_common_test.py | File | 8.18 KB | 0644 |
|
dns_test_common.py | File | 1.65 KB | 0644 |
|
dns_test_common_lexicon.py | File | 5.48 KB | 0644 |
|
enhancements.py | File | 5.58 KB | 0644 |
|
enhancements_test.py | File | 2.36 KB | 0644 |
|
manual.py | File | 7.88 KB | 0644 |
|
manual_test.py | File | 5.6 KB | 0644 |
|
null.py | File | 1.27 KB | 0644 |
|
null_test.py | File | 624 B | 0644 |
|
selection.py | File | 13.55 KB | 0644 |
|
selection_test.py | File | 7.78 KB | 0644 |
|
standalone.py | File | 7.72 KB | 0644 |
|
standalone_test.py | File | 6.64 KB | 0644 |
|
storage.py | File | 4.14 KB | 0644 |
|
storage_test.py | File | 5.47 KB | 0644 |
|
util.py | File | 1.69 KB | 0644 |
|
util_test.py | File | 1.81 KB | 0644 |
|
webroot.py | File | 12.08 KB | 0644 |
|
webroot_test.py | File | 13.11 KB | 0644 |
|