Quality check and test fixes.

This commit is contained in:
Jonathan Piacenti
2014-11-28 17:23:45 +00:00
committed by E. Kolpakov
parent fc4eed4240
commit eabd6c8d27
12 changed files with 55 additions and 24 deletions

View File

@@ -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('/course/')
resp = self.client.get_html('/home/')
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('/course/')
resp = self.client.get_html('/home/')
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('/course/').content)
course_listing = lxml.html.fromstring(self.client.get_html('/home/').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('/course/').content)
course_listing = lxml.html.fromstring(self.client.get_html('/home/').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)

View File

@@ -44,9 +44,9 @@ class InternationalizationTest(ModuleStoreTestCase):
self.client = AjaxEnabledTestClient()
self.client.login(username=self.uname, password=self.password)
resp = self.client.get_html('/course/')
resp = self.client.get_html('/home/')
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(
'/course/',
'/home/',
{},
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(
'/course/',
'/home/',
{},
HTTP_ACCEPT_LANGUAGE='eo'
)

View File

@@ -234,13 +234,13 @@ class AuthTestCase(ContentStoreTestCase):
def test_private_pages_auth(self):
"""Make sure pages that do require login work."""
auth_pages = (
'/course/',
'/home/',
)
# These are pages that should just load when the user is logged in
# (no data needed)
simple_auth_pages = (
'/course/',
'/home/',
)
# 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('/course/')
resp = self.client.get_html('/home/')
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 = '/course/'
course_url = '/home/'
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=/course/')
self.assertRedirects(resp, settings.LOGIN_REDIRECT_URL + '?next=/home/')
class ForumTestCase(CourseTestCase):

View File

@@ -66,6 +66,6 @@ def login_page(request):
def howitworks(request):
"Proxy view"
if request.user.is_authenticated():
return redirect('/course/')
return redirect('/home/')
else:
return render_to_response('howitworks.html', {})

View File

@@ -42,7 +42,7 @@ class TestCourseIndex(CourseTestCase):
"""
Test getting the list of courses and then pulling up their outlines
"""
index_url = '/course/'
index_url = '/home/'
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 = '/course/'
index_url = '/home/'
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')