MCPcopy Create free account
hub / github.com/apache/httpd / MDTestEnv

Class MDTestEnv

test/modules/md/md_env.py:53–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52
53class MDTestEnv(HttpdTestEnv):
54
55 MD_S_UNKNOWN = 0
56 MD_S_INCOMPLETE = 1
57 MD_S_COMPLETE = 2
58 MD_S_EXPIRED = 3
59 MD_S_ERROR = 4
60
61 EMPTY_JOUT = {'status': 0, 'output': []}
62
63 DOMAIN_SUFFIX = "%d.org" % time.time()
64 LOG_FMT_TIGHT = '%(levelname)s: %(message)s'
65
66 @classmethod
67 def get_acme_server(cls):
68 return os.environ['ACME'] if 'ACME' in os.environ else "pebble"
69
70 @classmethod
71 def has_acme_server(cls):
72 return cls.get_acme_server() != 'none'
73
74 @classmethod
75 def has_acme_eab(cls):
76 # Pebble, in v2.5.0 no longer supported HS256 for EAB, which
77 # is the only thing mod_md supports. Issue opened at pebble:
78 # https://github.com/letsencrypt/pebble/issues/455
79 # is fixed in v2.6.0
80 return cls.get_acme_server() == 'pebble'
81
82 @classmethod
83 def is_pebble(cls) -> bool:
84 return cls.get_acme_server() == 'pebble'
85
86 @classmethod
87 def lacks_ocsp(cls):
88 return cls.is_pebble()
89
90 @classmethod
91 def has_a2md(cls):
92 d = os.path.dirname(inspect.getfile(HttpdTestEnv))
93 config = ConfigParser(interpolation=ExtendedInterpolation())
94 config.read(os.path.join(d, 'config.ini'))
95 bin_dir = config.get('global', 'bindir')
96 a2md_bin = os.path.join(bin_dir, 'a2md')
97 return os.path.isfile(a2md_bin)
98
99 def __init__(self, pytestconfig=None):
100 super().__init__(pytestconfig=pytestconfig)
101 self.add_httpd_log_modules(["md"])
102 self._acme_server = self.get_acme_server()
103 self._acme_tos = "accepted"
104 self._acme_ca_pemfile = os.path.join(self.gen_dir, "apache/acme-ca.pem")
105 if "pebble" == self._acme_server:
106 self._acme_url = "https://localhost:14000/dir"
107 self._acme_eab_url = "https://localhost:14001/dir"
108 elif "boulder" == self._acme_server:
109 self._acme_url = "http://localhost:4001/directory"
110 self._acme_eab_url = None

Callers 2

pytest_report_headerFunction · 0.85
envFunction · 0.85

Calls

no outgoing calls

Tested by 2

pytest_report_headerFunction · 0.68
envFunction · 0.68