-
Notifications
You must be signed in to change notification settings - Fork 711
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2570 from willkg/1167008-motidings
[bug 1167008] Add missing motidings templates
- Loading branch information
Showing
5 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
kitsune/motidings/templates/motidings/unsubscribe_error.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% extends "base.html" %} | ||
{% set title = _('Unsubscribe') %} | ||
{% set crumbs = [(None, title)] %} | ||
|
||
{% block content %} | ||
<article class="main"> | ||
<h1>{{ _('Unsubscribe Error') }}</h1> | ||
|
||
<p> | ||
{% trans %} | ||
We could not find your subscription. Either it has already been | ||
cancelled, or there was a mistake in the unsubscribe link. Please make | ||
sure the entire link from the email made it into the browser. If the last | ||
part of the link wraps onto a second line in the email, try copying and | ||
pasting the link into the browser. | ||
{% endtrans %} | ||
</p> | ||
</article> | ||
{% endblock %} |
11 changes: 11 additions & 0 deletions
11
kitsune/motidings/templates/motidings/unsubscribe_success.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% extends "base.html" %} | ||
{% set title = _('Unsubscribe') %} | ||
{% set crumbs = [(None, title)] %} | ||
|
||
{% block content %} | ||
<article class="main"> | ||
<h1>{{ _('Unsubscribed') }}</h1> | ||
|
||
<p>{{ _('You have been unsubscribed.') }}</p> | ||
</article> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from factory import fuzzy | ||
from factory.django import DjangoModelFactory | ||
from tidings.models import Watch | ||
|
||
|
||
class WatchFactory(DjangoModelFactory): | ||
class Meta: | ||
model = Watch | ||
|
||
event_type = 'fooevent' | ||
is_active = True | ||
secret = fuzzy.FuzzyText(length=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from nose.tools import eq_ | ||
|
||
from kitsune.motidings.tests import WatchFactory | ||
from kitsune.sumo.tests import TestCase | ||
from kitsune.sumo.urlresolvers import reverse | ||
|
||
|
||
class UnsubscribeTests(TestCase): | ||
def test_view_get(self): | ||
watch = WatchFactory() | ||
|
||
url = reverse('tidings.unsubscribe', args=(watch.id,)) | ||
resp = self.client.get(url, follow=True) | ||
|
||
eq_(resp.status_code, 200) | ||
self.assertTemplateUsed('motidings/unsub.html') | ||
|
||
def test_view_post_success(self): | ||
watch = WatchFactory(secret='ou812') | ||
|
||
url = reverse('tidings.unsubscribe', args=(watch.id,), locale='en-US') | ||
resp = self.client.post(url + '?s={0}'.format(watch.secret)) | ||
|
||
eq_(resp.status_code, 200) | ||
self.assertTemplateUsed('motidings/unsubscribe_success.html') | ||
|
||
def test_view_post_error_wrong_doesnotexist(self): | ||
url = reverse('tidings.unsubscribe', args=(42,), locale='en-US') | ||
resp = self.client.post(url + '?s=applesandcinnamon') | ||
|
||
eq_(resp.status_code, 200) | ||
self.assertTemplateUsed('motidings/unsubscribe_error.html') | ||
|
||
def test_view_post_error_wrong_secret(self): | ||
watch = WatchFactory( | ||
secret='ou812' | ||
) | ||
url = reverse('tidings.unsubscribe', args=(watch.id,), locale='en-US') | ||
resp = self.client.post(url + '?s=applesandcinnamon') | ||
|
||
eq_(resp.status_code, 200) | ||
self.assertTemplateUsed('motidings/unsubscribe_error.html') |