Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
790328df
Commit
790328df
authored
Jul 17, 2013
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add acceptance test for one-click unsubscribe page
parent
47b51e93
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
0 deletions
+58
-0
common/djangoapps/terrain/steps.py
+7
-0
lms/djangoapps/notification_prefs/features/unsubscribe.feature
+22
-0
lms/djangoapps/notification_prefs/features/unsubscribe.py
+25
-0
lms/envs/acceptance.py
+4
-0
No files found.
common/djangoapps/terrain/steps.py
View file @
790328df
...
@@ -129,6 +129,13 @@ def should_have_link_with_id_and_text(step, link_id, text):
...
@@ -129,6 +129,13 @@ def should_have_link_with_id_and_text(step, link_id, text):
assert_equals
(
link
.
text
,
text
)
assert_equals
(
link
.
text
,
text
)
@step
(
r'should see a link to "([^"]*)" with the text "([^"]*)"$'
)
def
should_have_link_with_path_and_text
(
step
,
path
,
text
):
link
=
world
.
browser
.
find_link_by_text
(
text
)
assert
len
(
link
)
>
0
assert_equals
(
link
.
first
[
"href"
],
django_url
(
path
))
@step
(
r'should( not)? see "(.*)" (?:somewhere|anywhere) (?:in|on) (?:the|this) page'
)
@step
(
r'should( not)? see "(.*)" (?:somewhere|anywhere) (?:in|on) (?:the|this) page'
)
def
should_see_in_the_page
(
step
,
doesnt_appear
,
text
):
def
should_see_in_the_page
(
step
,
doesnt_appear
,
text
):
if
doesnt_appear
:
if
doesnt_appear
:
...
...
lms/djangoapps/notification_prefs/features/unsubscribe.feature
0 → 100644
View file @
790328df
Feature
:
One-click unsubscribe
As a user with notifications enabled
I want to be able to unsubscribe from notifications
Scenario
:
Unsubscribe when not logged in
Given
I am an edX user
And
I am not logged in
And
I have notifications enabled
When
I access my unsubscribe url
Then
my notifications should be disabled
And
I should see
"Unsubscribe Successful!"
somewhere on the page
And
I should see
"Click here to return to your dashboard"
somewhere on the page
And
I should see a link to
"/dashboard"
with the text
"here"
Scenario
:
Unsubscribe when logged in
Given
I am a logged in user
And
I have notifications enabled
When
I access my unsubscribe url
Then
my notifications should be disabled
And
I should see
"Unsubscribe Successful!"
somewhere on the page
And
I should see
"Click here to return to your dashboard"
somewhere on the page
And
I should see a link to
"/dashboard"
with the text
"here"
lms/djangoapps/notification_prefs/features/unsubscribe.py
0 → 100644
View file @
790328df
from
django.contrib.auth.models
import
User
from
lettuce
import
step
,
world
from
notification_prefs
import
NOTIFICATION_PREF_KEY
from
user_api.models
import
UserPreference
USERNAME
=
"robot"
UNSUB_TOKEN
=
"av9E-14sAP1bVBRCPbrTHQ=="
@step
(
u"I have notifications enabled"
)
def
enable_notifications
(
step_
):
user
=
User
.
objects
.
get
(
username
=
USERNAME
)
UserPreference
.
objects
.
create
(
user
=
user
,
key
=
NOTIFICATION_PREF_KEY
,
value
=
UNSUB_TOKEN
)
@step
(
u"I access my unsubscribe url"
)
def
access_unsubscribe_url
(
step_
):
world
.
visit
(
"/notification_prefs/unsubscribe/{0}/"
.
format
(
UNSUB_TOKEN
))
@step
(
u"my notifications should be disabled"
)
def
notifications_should_be_disabled
(
step_
):
user
=
User
.
objects
.
get
(
username
=
USERNAME
)
assert
not
UserPreference
.
objects
.
filter
(
user
=
user
,
key
=
NOTIFICATION_PREF_KEY
)
.
exists
()
lms/envs/acceptance.py
View file @
790328df
...
@@ -79,6 +79,10 @@ XQUEUE_INTERFACE = {
...
@@ -79,6 +79,10 @@ XQUEUE_INTERFACE = {
# acceptance tests. This makes them faster and more reliable
# acceptance tests. This makes them faster and more reliable
MITX_FEATURES
[
'STUB_VIDEO_FOR_TESTING'
]
=
True
MITX_FEATURES
[
'STUB_VIDEO_FOR_TESTING'
]
=
True
# Forums are disabled in test.py to speed up unit tests, but we do not have
# per-test control for acceptance tests
MITX_FEATURES
[
'ENABLE_DISCUSSION_SERVICE'
]
=
True
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
INSTALLED_APPS
+=
(
'lettuce.django'
,)
INSTALLED_APPS
+=
(
'lettuce.django'
,)
LETTUCE_APPS
=
(
'courseware'
,)
LETTUCE_APPS
=
(
'courseware'
,)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment