Revision d17392b7
Added by Serghei Mihai over 9 years ago
| tests/test_emailing.py | ||
|---|---|---|
|
def test_unsubscription_link(app, categories, announces):
|
||
|
for category in categories:
|
||
|
uuid = uuid4()
|
||
|
email = '%s@example.net' % uuid
|
||
|
scheme = 'mailto:'
|
||
|
uri = scheme + '%s@example.net' % uuid
|
||
|
s = Subscription.objects.create(category=category,
|
||
|
identifier=email,
|
||
|
identifier=uri,
|
||
|
uuid=str(uuid))
|
||
|
for announce in announces:
|
||
|
if announce.category != category:
|
||
| ... | ... | |
|
assert broadcast.result
|
||
|
assert mail.outbox
|
||
|
signature = signing.dumps({'category': announce.category.pk,
|
||
|
'identifier': email})
|
||
|
'identifier': uri})
|
||
|
unsubscription_link = reverse('unsubscribe', kwargs={'unsubscription_token': signature})
|
||
|
assert mail.outbox[0].subject == announce.title
|
||
|
assert unsubscription_link in mail.outbox[0].html
|
||
|
assert unsubscription_link in mail.outbox[0].text
|
||
|
mail.outbox = []
|
||
|
# make sure the uri schema is not in the page
|
||
|
resp = app.get(unsubscription_link)
|
||
|
assert scheme not in resp.content
|
||
Also available in: Unified diff
don't show identifier's scheme on unsubscription page (#12544)