From 7a84f38db986748019dd27ddd21abd09f981bf81 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Tue, 12 Dec 2017 20:14:39 +0200 Subject: [PATCH] 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. --- lemur/plugins/lemur_email/tests/test_email.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lemur/plugins/lemur_email/tests/test_email.py b/lemur/plugins/lemur_email/tests/test_email.py index 3eada55c..9d58402f 100644 --- a/lemur/plugins/lemur_email/tests/test_email.py +++ b/lemur/plugins/lemur_email/tests/test_email.py @@ -19,19 +19,15 @@ def test_render(certificate, endpoint): 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')) - f.write(body) + body = template.render(dict(message=data, hostname='lemur.test.example.com')) template = env.get_template('{}.html'.format('rotation')) certificate.endpoints.append(endpoint) - with open(os.path.join(dir_path, 'rotation-rendered.html'), 'w') as f: - body = template.render( - dict( - certificate=certificate_notification_output_schema.dump(certificate).data, - hostname='lemur.test.example.com' - ) + body = template.render( + dict( + certificate=certificate_notification_output_schema.dump(certificate).data, + hostname='lemur.test.example.com' ) - f.write(body) + )