From d53ea381a09c14767fc6c9777b9be03f51748d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Casaj=C3=BAs?= Date: Fri, 18 Mar 2022 15:55:59 +0100 Subject: [PATCH] Fix signature --- tests/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/utils.py b/tests/utils.py index ba756b17..b1224d57 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,6 +4,7 @@ import os import random import string from email.message import EmailMessage +from typing import Optional, Dict import jinja2 from flask import url_for @@ -64,11 +65,15 @@ def pretty(d): print(json.dumps(d, indent=2)) -def load_eml_file(filename: str, template_values={}) -> EmailMessage: +def load_eml_file( + filename: str, template_values: Optional[Dict[str, str]] = None +) -> EmailMessage: emails_dir = os.path.join( os.path.dirname(os.path.realpath(__file__)), "example_emls" ) fullpath = os.path.join(emails_dir, filename) template = jinja2.Template(open(fullpath).read()) + if not template_values: + template_values = {} rendered = template.render(**template_values) return email.message_from_string(rendered)