Don't write files from the test suite (#1020)

The lemur_email.tests.test_render test would fail when running unittests
from a read-only source tree.
This commit is contained in:
Marti Raudsepp 2017-12-12 20:14:39 +02:00 committed by kevgliss
parent ba4de07ad8
commit 7a84f38db9
1 changed files with 6 additions and 10 deletions

View File

@ -19,19 +19,15 @@ def test_render(certificate, endpoint):
template = env.get_template('{}.html'.format('expiration')) template = env.get_template('{}.html'.format('expiration'))
with open(os.path.join(dir_path, 'expiration-rendered.html'), 'w') as f: body = template.render(dict(message=data, hostname='lemur.test.example.com'))
body = template.render(dict(message=data, hostname='lemur.test.example.com'))
f.write(body)
template = env.get_template('{}.html'.format('rotation')) template = env.get_template('{}.html'.format('rotation'))
certificate.endpoints.append(endpoint) certificate.endpoints.append(endpoint)
with open(os.path.join(dir_path, 'rotation-rendered.html'), 'w') as f: body = template.render(
body = template.render( dict(
dict( certificate=certificate_notification_output_schema.dump(certificate).data,
certificate=certificate_notification_output_schema.dump(certificate).data, hostname='lemur.test.example.com'
hostname='lemur.test.example.com'
)
) )
f.write(body) )