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
eabd6c8d
Commit
eabd6c8d
authored
Nov 28, 2014
by
Jonathan Piacenti
Committed by
E. Kolpakov
Jan 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quality check and test fixes.
parent
fc4eed42
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
55 additions
and
24 deletions
+55
-24
cms/djangoapps/contentstore/tests/test_contentstore.py
+4
-4
cms/djangoapps/contentstore/tests/test_i18n.py
+5
-5
cms/djangoapps/contentstore/tests/tests.py
+5
-5
cms/djangoapps/contentstore/views/public.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_course_index.py
+2
-2
cms/templates/index.html
+1
-1
common/djangoapps/student/tests/test_login.py
+1
-1
common/test/acceptance/pages/lms/login_and_register.py
+2
-0
common/test/acceptance/tests/lms/test_lms.py
+4
-1
docs/shared/conf.py
+0
-1
pavelib/paver_tests/test_prereqs.py
+29
-2
pavelib/prereqs.py
+1
-1
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
eabd6c8d
...
...
@@ -1167,7 +1167,7 @@ class ContentStoreTest(ContentStoreTestCase):
def
test_course_index_view_with_no_courses
(
self
):
"""Test viewing the index page with no courses"""
# Create a course so there is something to view
resp
=
self
.
client
.
get_html
(
'/
cours
e/'
)
resp
=
self
.
client
.
get_html
(
'/
hom
e/'
)
self
.
assertContains
(
resp
,
'<h1 class="page-header">My Courses</h1>'
,
...
...
@@ -1189,7 +1189,7 @@ class ContentStoreTest(ContentStoreTestCase):
def
test_course_index_view_with_course
(
self
):
"""Test viewing the index page with an existing course"""
CourseFactory
.
create
(
display_name
=
'Robot Super Educational Course'
)
resp
=
self
.
client
.
get_html
(
'/
cours
e/'
)
resp
=
self
.
client
.
get_html
(
'/
hom
e/'
)
self
.
assertContains
(
resp
,
'<h3 class="course-title">Robot Super Educational Course</h3>'
,
...
...
@@ -1604,7 +1604,7 @@ class RerunCourseTest(ContentStoreTestCase):
Asserts that the given course key is in the accessible course listing section of the html
and NOT in the unsucceeded course action section of the html.
"""
course_listing
=
lxml
.
html
.
fromstring
(
self
.
client
.
get_html
(
'/
cours
e/'
)
.
content
)
course_listing
=
lxml
.
html
.
fromstring
(
self
.
client
.
get_html
(
'/
hom
e/'
)
.
content
)
self
.
assertEqual
(
len
(
self
.
get_course_listing_elements
(
course_listing
,
course_key
)),
1
)
self
.
assertEqual
(
len
(
self
.
get_unsucceeded_course_action_elements
(
course_listing
,
course_key
)),
0
)
...
...
@@ -1613,7 +1613,7 @@ class RerunCourseTest(ContentStoreTestCase):
Asserts that the given course key is in the unsucceeded course action section of the html
and NOT in the accessible course listing section of the html.
"""
course_listing
=
lxml
.
html
.
fromstring
(
self
.
client
.
get_html
(
'/
cours
e/'
)
.
content
)
course_listing
=
lxml
.
html
.
fromstring
(
self
.
client
.
get_html
(
'/
hom
e/'
)
.
content
)
self
.
assertEqual
(
len
(
self
.
get_course_listing_elements
(
course_listing
,
course_key
)),
0
)
self
.
assertEqual
(
len
(
self
.
get_unsucceeded_course_action_elements
(
course_listing
,
course_key
)),
1
)
...
...
cms/djangoapps/contentstore/tests/test_i18n.py
View file @
eabd6c8d
...
...
@@ -44,9 +44,9 @@ class InternationalizationTest(ModuleStoreTestCase):
self
.
client
=
AjaxEnabledTestClient
()
self
.
client
.
login
(
username
=
self
.
uname
,
password
=
self
.
password
)
resp
=
self
.
client
.
get_html
(
'/
cours
e/'
)
resp
=
self
.
client
.
get_html
(
'/
hom
e/'
)
self
.
assertContains
(
resp
,
'<h1 class="page-header">
My Courses
</h1>'
,
'<h1 class="page-header">
Studio Home
</h1>'
,
status_code
=
200
,
html
=
True
)
...
...
@@ -56,13 +56,13 @@ class InternationalizationTest(ModuleStoreTestCase):
self
.
client
.
login
(
username
=
self
.
uname
,
password
=
self
.
password
)
resp
=
self
.
client
.
get_html
(
'/
cours
e/'
,
'/
hom
e/'
,
{},
HTTP_ACCEPT_LANGUAGE
=
'en'
,
)
self
.
assertContains
(
resp
,
'<h1 class="page-header">
My Courses
</h1>'
,
'<h1 class="page-header">
Studio Home
</h1>'
,
status_code
=
200
,
html
=
True
)
...
...
@@ -81,7 +81,7 @@ class InternationalizationTest(ModuleStoreTestCase):
self
.
client
.
login
(
username
=
self
.
uname
,
password
=
self
.
password
)
resp
=
self
.
client
.
get_html
(
'/
cours
e/'
,
'/
hom
e/'
,
{},
HTTP_ACCEPT_LANGUAGE
=
'eo'
)
...
...
cms/djangoapps/contentstore/tests/tests.py
View file @
eabd6c8d
...
...
@@ -234,13 +234,13 @@ class AuthTestCase(ContentStoreTestCase):
def
test_private_pages_auth
(
self
):
"""Make sure pages that do require login work."""
auth_pages
=
(
'/
cours
e/'
,
'/
hom
e/'
,
)
# These are pages that should just load when the user is logged in
# (no data needed)
simple_auth_pages
=
(
'/
cours
e/'
,
'/
hom
e/'
,
)
# need an activated user
...
...
@@ -266,7 +266,7 @@ class AuthTestCase(ContentStoreTestCase):
def
test_index_auth
(
self
):
# not logged in. Should return a redirect.
resp
=
self
.
client
.
get_html
(
'/
cours
e/'
)
resp
=
self
.
client
.
get_html
(
'/
hom
e/'
)
self
.
assertEqual
(
resp
.
status_code
,
302
)
# Logged in should work.
...
...
@@ -283,7 +283,7 @@ class AuthTestCase(ContentStoreTestCase):
self
.
login
(
self
.
email
,
self
.
pw
)
# make sure we can access courseware immediately
course_url
=
'/
cours
e/'
course_url
=
'/
hom
e/'
resp
=
self
.
client
.
get_html
(
course_url
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
...
...
@@ -293,7 +293,7 @@ class AuthTestCase(ContentStoreTestCase):
resp
=
self
.
client
.
get_html
(
course_url
)
# re-request, and we should get a redirect to login page
self
.
assertRedirects
(
resp
,
settings
.
LOGIN_REDIRECT_URL
+
'?next=/
cours
e/'
)
self
.
assertRedirects
(
resp
,
settings
.
LOGIN_REDIRECT_URL
+
'?next=/
hom
e/'
)
class
ForumTestCase
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/public.py
View file @
eabd6c8d
...
...
@@ -66,6 +66,6 @@ def login_page(request):
def
howitworks
(
request
):
"Proxy view"
if
request
.
user
.
is_authenticated
():
return
redirect
(
'/
cours
e/'
)
return
redirect
(
'/
hom
e/'
)
else
:
return
render_to_response
(
'howitworks.html'
,
{})
cms/djangoapps/contentstore/views/tests/test_course_index.py
View file @
eabd6c8d
...
...
@@ -42,7 +42,7 @@ class TestCourseIndex(CourseTestCase):
"""
Test getting the list of courses and then pulling up their outlines
"""
index_url
=
'/
cours
e/'
index_url
=
'/
hom
e/'
index_response
=
authed_client
.
get
(
index_url
,
{},
HTTP_ACCEPT
=
'text/html'
)
parsed_html
=
lxml
.
html
.
fromstring
(
index_response
.
content
)
course_link_eles
=
parsed_html
.
find_class
(
'course-link'
)
...
...
@@ -68,7 +68,7 @@ class TestCourseIndex(CourseTestCase):
# Add a library:
lib1
=
LibraryFactory
.
create
()
index_url
=
'/
cours
e/'
index_url
=
'/
hom
e/'
index_response
=
self
.
client
.
get
(
index_url
,
{},
HTTP_ACCEPT
=
'text/html'
)
parsed_html
=
lxml
.
html
.
fromstring
(
index_response
.
content
)
library_link_elements
=
parsed_html
.
find_class
(
'library-link'
)
...
...
cms/templates/index.html
View file @
eabd6c8d
...
...
@@ -2,7 +2,7 @@
<
%
inherit
file=
"base.html"
/>
<
%
def
name=
"online_help_token()"
><
%
return
"
home
"
%
></
%
def>
<
%
block
name=
"title"
>
${_("
My Courses
")}
</
%
block>
<
%
block
name=
"title"
>
${_("
Studio Home
")}
</
%
block>
<
%
block
name=
"bodyclass"
>
is-signedin index view-dashboard
</
%
block>
<
%
block
name=
"requirejs"
>
...
...
common/djangoapps/student/tests/test_login.py
View file @
eabd6c8d
...
...
@@ -482,7 +482,7 @@ class LoginOAuthTokenMixin(object):
self
.
_setup_user_response
(
success
=
True
)
response
=
self
.
client
.
post
(
self
.
url
,
{
"access_token"
:
"dummy"
})
self
.
assertEqual
(
response
.
status_code
,
204
)
self
.
assertEqual
(
self
.
client
.
session
[
'_auth_user_id'
],
self
.
user
.
id
)
self
.
assertEqual
(
self
.
client
.
session
[
'_auth_user_id'
],
self
.
user
.
id
)
# pylint: disable=no-member
def
test_invalid_token
(
self
):
self
.
_setup_user_response
(
success
=
False
)
...
...
common/test/acceptance/pages/lms/login_and_register.py
View file @
eabd6c8d
...
...
@@ -246,6 +246,7 @@ class CombinedLoginAndRegisterPage(PageObject):
def
wait_for_errors
(
self
):
"""Wait for errors to be visible, then return them. """
def
_check_func
():
"""Return success status and any errors that occurred."""
errors
=
self
.
errors
return
(
bool
(
errors
),
errors
)
return
Promise
(
_check_func
,
"Errors are visible"
)
.
fulfill
()
...
...
@@ -259,6 +260,7 @@ class CombinedLoginAndRegisterPage(PageObject):
def
wait_for_success
(
self
):
"""Wait for a success message to be visible, then return it."""
def
_check_func
():
"""Return success status and any errors that occurred."""
success
=
self
.
success
return
(
bool
(
success
),
success
)
return
Promise
(
_check_func
,
"Success message is visible"
)
.
fulfill
()
common/test/acceptance/tests/lms/test_lms.py
View file @
eabd6c8d
...
...
@@ -119,7 +119,7 @@ class LoginFromCombinedPageTest(UniqueCourseTest):
def
test_password_reset_success
(
self
):
# Create a user account
email
,
password
=
self
.
_create_unique_user
()
email
,
password
=
self
.
_create_unique_user
()
# pylint: disable=unused-variable
# Navigate to the password reset form and try to submit it
self
.
login_page
.
visit
()
.
password_reset
(
email
=
email
)
...
...
@@ -141,6 +141,9 @@ class LoginFromCombinedPageTest(UniqueCourseTest):
)
def
_create_unique_user
(
self
):
"""
Create a new user with a unique name and email.
"""
username
=
"test_{uuid}"
.
format
(
uuid
=
self
.
unique_id
[
0
:
6
])
email
=
"{user}@example.com"
.
format
(
user
=
username
)
password
=
"password"
...
...
docs/shared/conf.py
View file @
eabd6c8d
...
...
@@ -22,7 +22,6 @@
# -----------------------------------------------------------------------------
import
os
import
sys
BASEDIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
...
pavelib/paver_tests/test_prereqs.py
View file @
eabd6c8d
import
os
import
unittest
from
pavelib.prereqs
import
no_prereq_install
class
TestPaverPrereqInstall
(
unittest
.
TestCase
):
"""
Test the status of the NO_PREREQ_INSTALL variable, its presence and how
paver handles it.
"""
def
check_val
(
self
,
set_val
,
expected_val
):
"""
Verify that setting the variable to a certain value returns
the expected boolean for it.
As environment variables are only stored as strings, we have to cast
whatever it's set at to a boolean that does not violate expectations.
"""
_orig_environ
=
dict
(
os
.
environ
)
os
.
environ
[
'NO_PREREQ_INSTALL'
]
=
set_val
self
.
assertEqual
(
...
...
@@ -21,19 +30,37 @@ class TestPaverPrereqInstall(unittest.TestCase):
os
.
environ
.
update
(
_orig_environ
)
def
test_no_prereq_install_true
(
self
):
"""
Ensure that 'true' will be True.
"""
self
.
check_val
(
'true'
,
True
)
def
test_no_prereq_install_false
(
self
):
"""
Ensure that 'false' will be False.
"""
self
.
check_val
(
'false'
,
False
)
def
test_no_prereq_install_True
(
self
):
"""
Ensure that 'True' will be True.
"""
self
.
check_val
(
'True'
,
True
)
def
test_no_prereq_install_False
(
self
):
"""
Ensure that 'False' will be False.
"""
self
.
check_val
(
'False'
,
False
)
def
test_no_prereq_install_0
(
self
):
"""
Ensure that '0' will be False.
"""
self
.
check_val
(
'0'
,
False
)
def
test_no_prereq_install_1
(
self
):
"""
Ensure that '1' will be True.
"""
self
.
check_val
(
'1'
,
True
)
pavelib/prereqs.py
View file @
eabd6c8d
...
...
@@ -41,7 +41,7 @@ def no_prereq_install():
try
:
return
vals
[
val
]
except
:
except
KeyError
:
return
False
...
...
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