Commit e8763ef7 by Mat Peterson Committed by Ben McMorran

Do TODOs in test_contentstore.py

parent d695de24
...@@ -1584,12 +1584,11 @@ class RerunCourseTest(ContentStoreTestCase): ...@@ -1584,12 +1584,11 @@ class RerunCourseTest(ContentStoreTestCase):
def create_course_listing_html(self, course_key): def create_course_listing_html(self, course_key):
"""Creates html fragment that is created for the given course_key in the course listing section""" """Creates html fragment that is created for the given course_key in the course listing section"""
return '<a class="course-link" href="/course/{}"'.format(course_key) return 'data-test-course="{}/{}/{}"'.format(course_key.org, course_key.course, course_key.run)
def create_unsucceeded_course_action_html(self, course_key): def create_unsucceeded_course_action_html(self, course_key):
"""Creates html fragment that is created for the given course_key in the unsucceeded course action section""" """Creates html fragment that is created for the given course_key in the unsucceeded course action section"""
# TODO Update this once the Rerun UI LMS-11011 is implemented. return 'data-test-unsucceeded="{}/{}/{}"'.format(course_key.org, course_key.course, course_key.run)
return '<div class="unsucceeded-course-action" href="/course/{}"'.format(course_key)
def assertInCourseListing(self, course_key): def assertInCourseListing(self, course_key):
""" """
...@@ -1597,7 +1596,7 @@ class RerunCourseTest(ContentStoreTestCase): ...@@ -1597,7 +1596,7 @@ class RerunCourseTest(ContentStoreTestCase):
and NOT in the unsucceeded course action section of the html. and NOT in the unsucceeded course action section of the html.
""" """
course_listing_html = self.client.get_html('/course/') course_listing_html = self.client.get_html('/course/')
self.assertIn(course_key.run, course_listing_html.content) self.assertIn(self.create_course_listing_html(course_key), course_listing_html.content)
self.assertNotIn(self.create_unsucceeded_course_action_html(course_key), course_listing_html.content) self.assertNotIn(self.create_unsucceeded_course_action_html(course_key), course_listing_html.content)
def assertInUnsucceededCourseActions(self, course_key): def assertInUnsucceededCourseActions(self, course_key):
...@@ -1606,8 +1605,8 @@ class RerunCourseTest(ContentStoreTestCase): ...@@ -1606,8 +1605,8 @@ class RerunCourseTest(ContentStoreTestCase):
and NOT in the accessible course listing section of the html. and NOT in the accessible course listing section of the html.
""" """
course_listing_html = self.client.get_html('/course/') course_listing_html = self.client.get_html('/course/')
self.assertNotIn(course_key.run, course_listing_html.content) self.assertNotIn(self.create_course_listing_html(course_key), course_listing_html.content)
# TODO Verify the course is in the unsucceeded listing once LMS-11011 is implemented. self.assertIn(self.create_unsucceeded_course_action_html(course_key), course_listing_html.content)
def test_rerun_course_success(self): def test_rerun_course_success(self):
...@@ -1650,7 +1649,7 @@ class RerunCourseTest(ContentStoreTestCase): ...@@ -1650,7 +1649,7 @@ class RerunCourseTest(ContentStoreTestCase):
self.assertInCourseListing(existent_course_key) self.assertInCourseListing(existent_course_key)
# Verify that the failed course is NOT in the course listings # Verify that the failed course is NOT in the course listings
self.assertInUnsucceededCourseActions(non_existent_course_key) self.assertInUnsucceededCourseActions(destination_course_key)
def test_rerun_course_fail_duplicate_course(self): def test_rerun_course_fail_duplicate_course(self):
existent_course_key = CourseFactory.create().id existent_course_key = CourseFactory.create().id
......
...@@ -140,7 +140,7 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) { ...@@ -140,7 +140,7 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) {
%for display_name, org, num, run, state_failed, state_in_progress, dismiss_link in sorted(unsucceeded_course_actions, key=lambda s: s[0].lower() if s[0] is not None else ''): %for display_name, org, num, run, state_failed, state_in_progress, dismiss_link in sorted(unsucceeded_course_actions, key=lambda s: s[0].lower() if s[0] is not None else ''):
<!-- STATE: re-run is processing --> <!-- STATE: re-run is processing -->
%if state_in_progress: %if state_in_progress:
<li class="wrapper-course has-status"> <li class="wrapper-course has-status" data-test-unsucceeded="${org}/${num}/${run}">
<div class="course-item course-rerun is-processing"> <div class="course-item course-rerun is-processing">
<div class="course-details" href="#"> <div class="course-details" href="#">
<h3 class="course-title">${display_name}</h3> <h3 class="course-title">${display_name}</h3>
...@@ -178,7 +178,7 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) { ...@@ -178,7 +178,7 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) {
<!-- STATE: re-run has error --> <!-- STATE: re-run has error -->
%if state_failed: %if state_failed:
<li class="wrapper-course has-status"> <li class="wrapper-course has-status" data-test-unsucceeded="${org}/${num}/${run}">
<div class="course-item course-rerun has-error"> <div class="course-item course-rerun has-error">
<div class="course-details" href="#"> <div class="course-details" href="#">
<h3 class="course-title">${display_name}</h3> <h3 class="course-title">${display_name}</h3>
...@@ -229,7 +229,7 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) { ...@@ -229,7 +229,7 @@ require(["domReady!", "jquery", "jquery.form", "js/index"], function(doc, $) {
<div class="courses"> <div class="courses">
<ul class="list-courses"> <ul class="list-courses">
%for course, url, lms_link, rerun_link, org, num, run in sorted(courses, key=lambda s: s[0].lower() if s[0] is not None else ''): %for course, url, lms_link, rerun_link, org, num, run in sorted(courses, key=lambda s: s[0].lower() if s[0] is not None else ''):
<li class="course-item"> <li class="course-item" data-test-course="${org}/${num}/${run}">
<a class="course-link" href="${url}"> <a class="course-link" href="${url}">
<h3 class="course-title">${course}</h3> <h3 class="course-title">${course}</h3>
......
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