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
31931827
Commit
31931827
authored
Oct 01, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kill DISABLE_RESET_EMAIL_TEST flag
We're better served by just directly testing if we're in the LMS or not.
parent
7f4cc1c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
27 deletions
+5
-27
cms/envs/test.py
+0
-3
common/djangoapps/student/tests/test_email.py
+3
-9
common/djangoapps/student/tests/test_reset_password.py
+2
-15
No files found.
cms/envs/test.py
View file @
31931827
...
@@ -190,9 +190,6 @@ SEGMENT_IO_KEY = '***REMOVED***'
...
@@ -190,9 +190,6 @@ SEGMENT_IO_KEY = '***REMOVED***'
FEATURES
[
'ENABLE_SERVICE_STATUS'
]
=
True
FEATURES
[
'ENABLE_SERVICE_STATUS'
]
=
True
# This is to disable a test under the common directory that will not pass when run under CMS
FEATURES
[
'DISABLE_RESET_EMAIL_TEST'
]
=
True
# Toggles embargo on for testing
# Toggles embargo on for testing
FEATURES
[
'EMBARGO'
]
=
True
FEATURES
[
'EMBARGO'
]
=
True
...
...
common/djangoapps/student/tests/test_email.py
View file @
31931827
...
@@ -272,9 +272,7 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
...
@@ -272,9 +272,7 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
self
.
check_confirm_email_change
(
'email_exists.html'
,
{})
self
.
check_confirm_email_change
(
'email_exists.html'
,
{})
self
.
assertFailedBeforeEmailing
(
email_user
)
self
.
assertFailedBeforeEmailing
(
email_user
)
@unittest.skipIf
(
settings
.
FEATURES
.
get
(
'DISABLE_RESET_EMAIL_TEST'
,
False
),
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
"Test only valid in LMS"
)
dedent
(
"""Skipping Test because CMS has not provided necessary templates for email reset.
If LMS tests print this message, that needs to be fixed."""
))
def
test_old_email_fails
(
self
,
email_user
):
def
test_old_email_fails
(
self
,
email_user
):
email_user
.
side_effect
=
[
Exception
,
None
]
email_user
.
side_effect
=
[
Exception
,
None
]
self
.
check_confirm_email_change
(
'email_change_failed.html'
,
{
self
.
check_confirm_email_change
(
'email_change_failed.html'
,
{
...
@@ -283,9 +281,7 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
...
@@ -283,9 +281,7 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
self
.
assertRolledBack
()
self
.
assertRolledBack
()
self
.
assertChangeEmailSent
(
email_user
)
self
.
assertChangeEmailSent
(
email_user
)
@unittest.skipIf
(
settings
.
FEATURES
.
get
(
'DISABLE_RESET_EMAIL_TEST'
,
False
),
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
"Test only valid in LMS"
)
dedent
(
"""Skipping Test because CMS has not provided necessary templates for email reset.
If LMS tests print this message, that needs to be fixed."""
))
def
test_new_email_fails
(
self
,
email_user
):
def
test_new_email_fails
(
self
,
email_user
):
email_user
.
side_effect
=
[
None
,
Exception
]
email_user
.
side_effect
=
[
None
,
Exception
]
self
.
check_confirm_email_change
(
'email_change_failed.html'
,
{
self
.
check_confirm_email_change
(
'email_change_failed.html'
,
{
...
@@ -294,9 +290,7 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
...
@@ -294,9 +290,7 @@ class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase):
self
.
assertRolledBack
()
self
.
assertRolledBack
()
self
.
assertChangeEmailSent
(
email_user
)
self
.
assertChangeEmailSent
(
email_user
)
@unittest.skipIf
(
settings
.
FEATURES
.
get
(
'DISABLE_RESET_EMAIL_TEST'
,
False
),
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
"Test only valid in LMS"
)
dedent
(
"""Skipping Test because CMS has not provided necessary templates for email reset.
If LMS tests print this message, that needs to be fixed."""
))
def
test_successful_email_change
(
self
,
email_user
):
def
test_successful_email_change
(
self
,
email_user
):
self
.
check_confirm_email_change
(
'email_change_successful.html'
,
{
self
.
check_confirm_email_change
(
'email_change_successful.html'
,
{
'old_email'
:
self
.
user
.
email
,
'old_email'
:
self
.
user
.
email
,
...
...
common/djangoapps/student/tests/test_reset_password.py
View file @
31931827
...
@@ -15,7 +15,6 @@ from django.contrib.auth.tokens import default_token_generator
...
@@ -15,7 +15,6 @@ from django.contrib.auth.tokens import default_token_generator
from
django.utils.http
import
int_to_base36
from
django.utils.http
import
int_to_base36
from
mock
import
Mock
,
patch
from
mock
import
Mock
,
patch
from
textwrap
import
dedent
import
ddt
import
ddt
from
student.views
import
password_reset
,
password_reset_confirm_wrapper
from
student.views
import
password_reset
,
password_reset_confirm_wrapper
...
@@ -90,13 +89,7 @@ class ResetPasswordTests(TestCase):
...
@@ -90,13 +89,7 @@ class ResetPasswordTests(TestCase):
cache
.
clear
()
cache
.
clear
()
@unittest.skipIf
(
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
"Test only valid in LMS"
)
settings
.
FEATURES
.
get
(
'DISABLE_RESET_EMAIL_TEST'
,
False
),
dedent
(
"""
Skipping Test because CMS has not provided necessary templates for password reset.
If LMS tests print this message, that needs to be fixed.
"""
)
)
@patch
(
'django.core.mail.send_mail'
)
@patch
(
'django.core.mail.send_mail'
)
@patch
(
'student.views.render_to_string'
,
Mock
(
side_effect
=
mock_render_to_string
,
autospec
=
True
))
@patch
(
'student.views.render_to_string'
,
Mock
(
side_effect
=
mock_render_to_string
,
autospec
=
True
))
def
test_reset_password_email
(
self
,
send_email
):
def
test_reset_password_email
(
self
,
send_email
):
...
@@ -123,13 +116,7 @@ class ResetPasswordTests(TestCase):
...
@@ -123,13 +116,7 @@ class ResetPasswordTests(TestCase):
self
.
assertFalse
(
self
.
user
.
is_active
)
self
.
assertFalse
(
self
.
user
.
is_active
)
re
.
search
(
r'password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'
,
msg
)
.
groupdict
()
re
.
search
(
r'password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'
,
msg
)
.
groupdict
()
@unittest.skipIf
(
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
"Test only valid in LMS"
)
settings
.
FEATURES
.
get
(
'DISABLE_RESET_EMAIL_TEST'
,
False
),
dedent
(
"""
Skipping Test because CMS has not provided necessary templates for password reset.
If LMS tests print this message, that needs to be fixed.
"""
)
)
@patch
(
'django.core.mail.send_mail'
)
@patch
(
'django.core.mail.send_mail'
)
@ddt.data
((
False
,
'http://'
),
(
True
,
'https://'
))
@ddt.data
((
False
,
'http://'
),
(
True
,
'https://'
))
@ddt.unpack
@ddt.unpack
...
...
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