test: Switch the contentstore tests to use APIs
Since we're trying to drop the underlying page, switch to the equivalent API views for these contentstore tests.
This commit is contained in:
@@ -16,11 +16,11 @@ from unittest import SkipTest, mock
|
||||
from uuid import uuid4
|
||||
|
||||
import ddt
|
||||
import lxml.html
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
from edx_toggles.toggles.testutils import override_waffle_switch, override_waffle_flag
|
||||
from edxval.api import create_video, get_videos_for_course
|
||||
from fs.osfs import OSFS
|
||||
@@ -1388,17 +1388,6 @@ class ContentStoreTest(ContentStoreTestCase):
|
||||
resp = self.client.ajax_post('/course/', self.course_data)
|
||||
self.assertEqual(resp.status_code, 403)
|
||||
|
||||
@override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True)
|
||||
def test_course_index_view_with_no_courses(self):
|
||||
"""Test viewing the index page with no courses"""
|
||||
resp = self.client.get_html('/home/')
|
||||
self.assertContains(
|
||||
resp,
|
||||
f'<h1 class="page-header">{settings.STUDIO_SHORT_NAME} Home</h1>',
|
||||
status_code=200,
|
||||
html=True
|
||||
)
|
||||
|
||||
def test_course_factory(self):
|
||||
"""Test that the course factory works correctly."""
|
||||
course = CourseFactory.create()
|
||||
@@ -1879,17 +1868,21 @@ class RerunCourseTest(ContentStoreTestCase):
|
||||
"""
|
||||
Asserts that the given course key is NOT in the unsucceeded course action section of the html.
|
||||
"""
|
||||
with override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True):
|
||||
course_listing = lxml.html.fromstring(self.client.get_html('/home/').content)
|
||||
self.assertEqual(len(self.get_unsucceeded_course_action_elements(course_listing, course_key)), 0)
|
||||
response = self.client.get(reverse('cms.djangoapps.contentstore:v2:courses'))
|
||||
assert str(course_key) not in [
|
||||
course["course_key"]
|
||||
for course in response.json()["results"]["in_process_course_actions"]
|
||||
]
|
||||
|
||||
def assertInUnsucceededCourseActions(self, course_key):
|
||||
"""
|
||||
Asserts that the given course key is in the unsucceeded course action section of the html.
|
||||
"""
|
||||
with override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True):
|
||||
course_listing = lxml.html.fromstring(self.client.get_html('/home/').content)
|
||||
self.assertEqual(len(self.get_unsucceeded_course_action_elements(course_listing, course_key)), 1)
|
||||
response = self.client.get(reverse('cms.djangoapps.contentstore:v2:courses'))
|
||||
assert str(course_key) in [
|
||||
course["course_key"]
|
||||
for course in response.json()["results"]["in_process_course_actions"]
|
||||
]
|
||||
|
||||
def verify_rerun_course(self, source_course_key, destination_course_key, destination_display_name):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user