Son Nguyen Kim 2022-09-07 10:22:11 +02:00 committed by GitHub
parent f47661c3d2
commit 753a28e886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -994,7 +994,11 @@ def add_header(msg: Message, text_header, html_header=None) -> Message:
return msg
def replace(msg: Message, old, new) -> Message:
def replace(msg: Union[Message, str], old, new) -> Union[Message, str]:
if type(msg) is str:
msg = msg.replace(old, new)
return msg
content_type = msg.get_content_type()
if (

View File

@ -460,6 +460,12 @@ Content-Type: text/html; charset=us-ascii
assert "old" not in new_msg.as_string()
def test_replace_str():
msg = "a string"
new_msg = replace(msg, "a", "still a")
assert new_msg == "still a string"
def test_generate_reply_email(flask_client):
user = create_new_user()
reply_email = generate_reply_email("test@example.org", user)