Révision 1fa88fd7
Ajouté par Frédéric Péters il y a presque 8 ans
tests/test_emailing.py | ||
---|---|---|
2 | 2 |
import json |
3 | 3 |
from uuid import uuid4 |
4 | 4 |
import os |
5 |
import re |
|
5 | 6 |
|
6 | 7 |
from django.core.urlresolvers import reverse |
7 | 8 |
from django.utils.http import urlencode |
... | ... | |
108 | 109 |
broadcast.send() |
109 | 110 |
assert broadcast.result |
110 | 111 |
assert mail.outbox |
111 |
signature = signing.dumps({'category': announce.category.pk, |
|
112 |
'identifier': uri})
|
|
112 |
|
|
113 |
signature = re.findall('/unsubscribe/(.*)"', mail.outbox[0].html)[0]
|
|
113 | 114 |
unsubscription_link = reverse('unsubscribe', kwargs={'unsubscription_token': signature}) |
115 |
assert signing.loads(signature) == { |
|
116 |
'category': announce.category.pk, 'identifier': uri} |
|
114 | 117 |
assert mail.outbox[0].subject == announce.title |
115 | 118 |
assert unsubscription_link in mail.outbox[0].html |
116 | 119 |
assert unsubscription_link in mail.outbox[0].text |
Formats disponibles : Unified diff
tests: don't recompute unsubscribe link signature (#12806)