Revision d17392b7
Added by Serghei Mihai over 8 years ago
tests/test_emailing.py | ||
---|---|---|
96 | 96 |
def test_unsubscription_link(app, categories, announces): |
97 | 97 |
for category in categories: |
98 | 98 |
uuid = uuid4() |
99 |
email = '%s@example.net' % uuid |
|
99 |
scheme = 'mailto:' |
|
100 |
uri = scheme + '%s@example.net' % uuid |
|
100 | 101 |
s = Subscription.objects.create(category=category, |
101 |
identifier=email,
|
|
102 |
identifier=uri,
|
|
102 | 103 |
uuid=str(uuid)) |
103 | 104 |
for announce in announces: |
104 | 105 |
if announce.category != category: |
... | ... | |
108 | 109 |
assert broadcast.result |
109 | 110 |
assert mail.outbox |
110 | 111 |
signature = signing.dumps({'category': announce.category.pk, |
111 |
'identifier': email})
|
|
112 |
'identifier': uri})
|
|
112 | 113 |
unsubscription_link = reverse('unsubscribe', kwargs={'unsubscription_token': signature}) |
113 | 114 |
assert mail.outbox[0].subject == announce.title |
114 | 115 |
assert unsubscription_link in mail.outbox[0].html |
115 | 116 |
assert unsubscription_link in mail.outbox[0].text |
116 | 117 |
mail.outbox = [] |
118 |
# make sure the uri schema is not in the page |
|
119 |
resp = app.get(unsubscription_link) |
|
120 |
assert scheme not in resp.content |
Also available in: Unified diff
don't show identifier's scheme on unsubscription page (#12544)