mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 17:01:29 +02:00
handle case address.parse can also parse an URL and return UrlAddress
This commit is contained in:
parent
7bfdb821af
commit
283a6a530d
@ -1321,4 +1321,9 @@ def parse_full_address(full_address) -> (str, str):
|
||||
full_address: EmailAddress = address.parse(full_address)
|
||||
if full_address is None:
|
||||
raise ValueError
|
||||
|
||||
# address.parse can also parse an URL and return UrlAddress
|
||||
if type(full_address) is not EmailAddress:
|
||||
raise ValueError
|
||||
|
||||
return full_address.display_name, full_address.address
|
||||
|
@ -3,6 +3,7 @@ import os
|
||||
from email.message import EmailMessage
|
||||
|
||||
import arrow
|
||||
import pytest
|
||||
|
||||
from app.config import MAX_ALERT_24H, EMAIL_DOMAIN, BOUNCE_EMAIL, ROOT_DIR
|
||||
from app.db import Session
|
||||
@ -134,6 +135,9 @@ def test_parse_full_address():
|
||||
"abcd@gmail.com",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
parse_full_address("https://ab.cd")
|
||||
|
||||
|
||||
def test_send_email_with_rate_control(flask_client):
|
||||
user = User.create(
|
||||
|
Loading…
Reference in New Issue
Block a user