diff --git a/lms/djangoapps/staticbook/tests.py b/lms/djangoapps/staticbook/tests.py index 6b21bbf014..ecc8e3303c 100644 --- a/lms/djangoapps/staticbook/tests.py +++ b/lms/djangoapps/staticbook/tests.py @@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE from student.tests.factories import UserFactory, CourseEnrollmentFactory -from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory +from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase @@ -40,9 +40,9 @@ class StaticBookTest(ModuleStoreTestCase): Make a course with an enrolled logged-in student. """ course = CourseFactory.create(**kwargs) - self.user = UserFactory.create() - CourseEnrollmentFactory.create(user=self.user, course_id=course.id) - self.client.login(username=self.user.username, password='test') + user = UserFactory.create() + CourseEnrollmentFactory.create(user=user, course_id=course.id) + self.client.login(username=user.username, password='test') return course diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 42c66aa4c8..9ed14bfb6c 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -1,3 +1,7 @@ +""" +Views for serving static textbooks. +""" + from django.contrib.auth.decorators import login_required from django.http import Http404 from mitxmako.shortcuts import render_to_response @@ -10,6 +14,9 @@ from static_replace import replace_static_urls @login_required def index(request, course_id, book_index, page=None): + """ + Serve static image-based textbooks. + """ course = get_course_with_access(request.user, course_id, 'load') staff_access = has_access(request.user, course, 'staff')