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

Method test_md_901_011

test/modules/md/test_901_message.py:181–214  ·  view source on GitHub ↗
(self, env)

Source from the content-addressed store, hash-verified

179 assert not os.path.isfile(self.mlog)
180
181 def test_md_901_011(self, env):
182 # MD with static cert files, lifetime in warn window, check message
183 domain = self.test_domain
184 domains = [domain, f'www.{domain}']
185 testpath = os.path.join(env.gen_dir, 'test_901_011')
186 env.mkpath(testpath)
187 # cert that is only 5 more days valid
188 creds = env.create_self_signed_cert(CertificateSpec(domains=domains),
189 valid_from=timedelta(days=-85),
190 valid_to=timedelta(days=5),
191 serial=901010)
192 cert_file = os.path.join(testpath, 'pubcert.pem')
193 pkey_file = os.path.join(testpath, 'privkey.pem')
194 creds.save_cert_pem(cert_file)
195 creds.save_pkey_pem(pkey_file)
196 conf = MDConf(env)
197 conf.add(f"MDMessageCmd {self.mcmd} {self.mlog}")
198 conf.start_md(domains)
199 conf.add(f"MDCertificateFile {cert_file}")
200 conf.add(f"MDCertificateKeyFile {pkey_file}")
201 conf.end_md()
202 conf.add_vhost(domain)
203 conf.install()
204 assert env.apache_restart() == 0, f'{env.apachectl_stderr}'
205 assert env.await_file(self.mlog)
206 nlines = open(self.mlog).readlines()
207 assert len(nlines) == 1
208 assert nlines[0].strip() == f"['{self.mcmd}', '{self.mlog}', 'expiring', '{domain}']"
209 # check that we do not get it resend right away again
210 assert env.apache_restart() == 0, f'{env.apachectl_stderr}'
211 time.sleep(1)
212 nlines = open(self.mlog).readlines()
213 assert len(nlines) == 1
214 assert nlines[0].strip() == f"['{self.mcmd}', '{self.mlog}', 'expiring', '{domain}']"
215
216 # MD, check messages from stapling
217 @pytest.mark.skipif(MDTestEnv.lacks_ocsp(), reason="no OCSP responder")

Callers

nothing calls this directly

Calls 14

start_mdMethod · 0.95
end_mdMethod · 0.95
CertificateSpecClass · 0.90
MDConfClass · 0.85
joinMethod · 0.80
mkpathMethod · 0.80
save_cert_pemMethod · 0.80
save_pkey_pemMethod · 0.80
addMethod · 0.80
add_vhostMethod · 0.80
installMethod · 0.80

Tested by

no test coverage detected