Commit 8c93eac6 by Andy Armstrong

Add an empty course message to the course home page

LEARNER-27
parent 8fbf01cd
......@@ -25,4 +25,4 @@
// Features
@import 'features/bookmarks';
@import 'features/course-outline';
@import 'features/course-experience';
// Course sidebar
.course-sidebar {
@include margin-left(0);
@include padding-left($baseline);
}
// Course outline
.course-outline {
color: $lms-gray;
......
......@@ -64,7 +64,7 @@ from openedx.features.course_experience import UNIFIED_COURSE_EXPERIENCE_FLAG
<main class="layout-col layout-col-b">
${HTML(outline_fragment.body_html())}
</main>
<aside class="layout-col layout-col-a">
<aside class="course-sidebar layout-col layout-col-a">
<div class="section section-tools">
<h3 class="hd-6">${_("Course Tools")}</h3>
<ul class="list-unstyled">
......
......@@ -2,6 +2,7 @@
Tests for the Course Outline view and supporting views.
"""
import datetime
import ddt
from mock import patch
import json
......@@ -12,10 +13,13 @@ from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.course_module import DEFAULT_START_DATE
from .test_course_home import course_home_url
TEST_PASSWORD = 'test'
FUTURE_DAY = datetime.datetime.now() + datetime.timedelta(days=30)
PAST_DAY = datetime.datetime.now() - datetime.timedelta(days=30)
class TestCourseOutlinePage(SharedModuleStoreTestCase):
......@@ -160,3 +164,25 @@ class TestCourseOutlinePreview(SharedModuleStoreTestCase):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, 'Future Chapter')
@ddt.ddt
class TestEmptyCourseOutlinePage(SharedModuleStoreTestCase):
"""
Test the new course outline view.
"""
@ddt.data(
(FUTURE_DAY, 'This course has not started yet, and will launch on'),
(PAST_DAY, "We're still working on course content."),
(DEFAULT_START_DATE, 'This course has not started yet.'),
)
@ddt.unpack
def test_empty_course_rendering(self, start_date, expected_text):
course = CourseFactory.create(start=start_date)
test_user = UserFactory(password=TEST_PASSWORD)
CourseEnrollment.enroll(test_user, course.id)
self.client.login(username=test_user.username, password=TEST_PASSWORD)
url = course_home_url(course)
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, expected_text)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment