diff --git a/cms/djangoapps/contentstore/views/tests/test_videos.py b/cms/djangoapps/contentstore/views/tests/test_videos.py index cb365e8af0..9f97147021 100644 --- a/cms/djangoapps/contentstore/views/tests/test_videos.py +++ b/cms/djangoapps/contentstore/views/tests/test_videos.py @@ -958,10 +958,7 @@ class VideoImageTestCase(VideoUploadTestBase, CourseTestCase): 'width': 16, # 16x9 'height': 9 }, - ( - u'Recommended image resolution is {image_file_max_width}x{image_file_max_height}. ' - u'The minimum resolution is {image_file_min_width}x{image_file_min_height}.' - ).format( + u'Recommended image resolution is {image_file_max_width}x{image_file_max_height}. The minimum resolution is {image_file_min_width}x{image_file_min_height}.'.format( image_file_max_width=settings.VIDEO_IMAGE_MAX_WIDTH, image_file_max_height=settings.VIDEO_IMAGE_MAX_HEIGHT, image_file_min_width=settings.VIDEO_IMAGE_MIN_WIDTH, @@ -973,10 +970,7 @@ class VideoImageTestCase(VideoUploadTestBase, CourseTestCase): 'width': settings.VIDEO_IMAGE_MIN_WIDTH - 10, 'height': settings.VIDEO_IMAGE_MIN_HEIGHT }, - ( - u'Recommended image resolution is {image_file_max_width}x{image_file_max_height}. ' - u'The minimum resolution is {image_file_min_width}x{image_file_min_height}.' - ).format( + u'Recommended image resolution is {image_file_max_width}x{image_file_max_height}. The minimum resolution is {image_file_min_width}x{image_file_min_height}.'.format( image_file_max_width=settings.VIDEO_IMAGE_MAX_WIDTH, image_file_max_height=settings.VIDEO_IMAGE_MAX_HEIGHT, image_file_min_width=settings.VIDEO_IMAGE_MIN_WIDTH, diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index be52bf8360..9a49dec2d5 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -695,7 +695,7 @@ def student_dashboard(request): for program in inverted_programs.values(): try: program_uuid = program[0]['uuid'] - program_data = get_programs(uuid=program_uuid) + program_data = get_programs(request.site, uuid=program_uuid) program_data = ProgramDataExtender(program_data, request.user).extend() skus = program_data.get('skus') checkout_page_url = ecommerce_service.get_checkout_page_url(*skus) diff --git a/common/djangoapps/terrain/stubs/catalog.py b/common/djangoapps/terrain/stubs/catalog.py index 04c6a8b24d..f33075a774 100644 --- a/common/djangoapps/terrain/stubs/catalog.py +++ b/common/djangoapps/terrain/stubs/catalog.py @@ -15,8 +15,7 @@ class StubCatalogServiceHandler(StubHttpRequestHandler): r'/api/v1/programs/$': self.program_list, r'/api/v1/programs/([0-9a-f-]+)/$': self.program_detail, r'/api/v1/program_types/$': self.program_types, - r'/api/v1/pathways/$': self.pathways, - r'/api/v1/course_runs/$': self.course_runs, + r'/api/v1/pathways/$': self.pathways } if self.match_pattern(pattern_handlers): @@ -53,10 +52,6 @@ class StubCatalogServiceHandler(StubHttpRequestHandler): pathways = self.server.config.get('catalog.pathways', []) self.send_json_response(pathways) - def course_runs(self): - course_runs = self.server.config.get('catalog.course_runs', {'results': [], 'next': None}) - self.send_json_response(course_runs) - class StubCatalogService(StubHttpService): HANDLER_CLASS = StubCatalogServiceHandler diff --git a/common/test/acceptance/fixtures/catalog.py b/common/test/acceptance/fixtures/catalog.py index ecef37b7fa..4d1bdea678 100644 --- a/common/test/acceptance/fixtures/catalog.py +++ b/common/test/acceptance/fixtures/catalog.py @@ -13,8 +13,7 @@ class CatalogFixture(object): """ Interface to set up mock responses from the Catalog stub server. """ - @classmethod - def install_programs(cls, programs): + def install_programs(self, programs): """ Stub the discovery service's program list and detail API endpoints. @@ -41,8 +40,7 @@ class CatalogFixture(object): data={key: json.dumps(uuids)}, ) - @classmethod - def install_pathways(cls, pathways): + def install_pathways(self, pathways): """ Stub the discovery service's credit pathways API endpoint @@ -54,8 +52,7 @@ class CatalogFixture(object): data={'catalog.pathways': json.dumps({'results': pathways, 'next': None})} ) - @classmethod - def install_program_types(cls, program_types): + def install_program_types(self, program_types): """ Stub the discovery service's program type list API endpoints. @@ -67,25 +64,10 @@ class CatalogFixture(object): data={'catalog.programs_types': json.dumps(program_types)}, ) - @classmethod - def install_course_runs(cls, course_runs): - """ - Stub the discovery service's course run list API endpoints. - - Arguments: - course_runs (list): A list of course runs. List endpoint will be stubbed using data from this list. - """ - requests.put( - '{}/set_config'.format(CATALOG_STUB_URL), - data={'catalog.course_runs': json.dumps({'results': course_runs, 'next': None})} - ) - class CatalogIntegrationMixin(object): """Mixin providing a method used to configure the catalog integration.""" - - @classmethod - def set_catalog_integration(cls, is_enabled=False, service_username=None): + def set_catalog_integration(self, is_enabled=False, service_username=None): """Use this to change the catalog integration config model during tests.""" ConfigModelFixture('/config/catalog', { 'enabled': is_enabled, diff --git a/common/test/acceptance/tests/lms/test_programs.py b/common/test/acceptance/tests/lms/test_programs.py index 12fa19a06b..06de2b8a2f 100644 --- a/common/test/acceptance/tests/lms/test_programs.py +++ b/common/test/acceptance/tests/lms/test_programs.py @@ -11,8 +11,7 @@ from openedx.core.djangoapps.catalog.tests.factories import ( CourseRunFactory, PathwayFactory, ProgramFactory, - ProgramTypeFactory, - ProgramDescriptionFactory, + ProgramTypeFactory ) @@ -25,12 +24,6 @@ class ProgramPageBase(ProgramsConfigMixin, CatalogIntegrationMixin, UniqueCourse self.programs = ProgramFactory.create_batch(3) self.pathways = PathwayFactory.create_batch(3) - self.course_runs = [ - CourseRunFactory.create(programs=[ProgramDescriptionFactory.from_program(program)], **course_run) - for program in self.programs - for course in program['courses'] - for course_run in course['course_runs'] - ] for pathway in self.pathways: self.programs += pathway['programs'] @@ -58,28 +51,18 @@ class ProgramPageBase(ProgramsConfigMixin, CatalogIntegrationMixin, UniqueCourse program_type = ProgramTypeFactory() return ProgramFactory(courses=[course], type=program_type['name']) - def stub_catalog_api(self, programs=None, pathways=None, course_runs=None): + def stub_catalog_api(self, programs, pathways): """ Stub the discovery service's program list and detail API endpoints, as well as the credit pathway list endpoint. """ self.set_catalog_integration(is_enabled=True, service_username=self.username) - - if programs is None: - programs = self.programs - - CatalogFixture.install_programs(programs) + CatalogFixture().install_programs(programs) program_types = [program['type'] for program in programs] - CatalogFixture.install_program_types(program_types) + CatalogFixture().install_program_types(program_types) - if pathways is None: - pathways = self.pathways - CatalogFixture.install_pathways(pathways) - - if course_runs is None: - course_runs = self.course_runs - CatalogFixture.install_course_runs(course_runs) + CatalogFixture().install_pathways(pathways) def cache_programs(self): """ @@ -101,7 +84,7 @@ class ProgramListingPageTest(ProgramPageBase): def test_no_enrollments(self): """Verify that no cards appear when the user has no enrollments.""" self.auth(enroll=False) - self.stub_catalog_api() + self.stub_catalog_api(self.programs, self.pathways) self.cache_programs() self.listing_page.visit() @@ -115,7 +98,7 @@ class ProgramListingPageTest(ProgramPageBase): but none are included in an active program. """ self.auth() - self.stub_catalog_api() + self.stub_catalog_api(self.programs, self.pathways) self.cache_programs() self.listing_page.visit() @@ -143,15 +126,7 @@ class ProgramListingPageA11yTest(ProgramPageBase): ] }) self.auth(enroll=False) - self.stub_catalog_api( - programs=[self.program], - pathways=[], - course_runs=[ - CourseRunFactory.create(programs=[ProgramDescriptionFactory.from_program(self.program)], **course_run) - for course in self.program['courses'] - for course_run in course['course_runs'] - ] - ) + self.stub_catalog_api(programs=[self.program], pathways=[]) self.cache_programs() self.listing_page.visit() @@ -168,15 +143,7 @@ class ProgramListingPageA11yTest(ProgramPageBase): ] }) self.auth() - self.stub_catalog_api( - programs=[self.program], - pathways=[], - course_runs=[ - CourseRunFactory.create(programs=[ProgramDescriptionFactory.from_program(self.program)], **course_run) - for course in self.program['courses'] - for course_run in course['course_runs'] - ] - ) + self.stub_catalog_api(programs=[self.program], pathways=[]) self.cache_programs() self.listing_page.visit() @@ -206,15 +173,7 @@ class ProgramDetailsPageA11yTest(ProgramPageBase): ] }) self.auth() - self.stub_catalog_api( - programs=[self.program], - pathways=[], - course_runs=[ - CourseRunFactory.create(programs=[ProgramDescriptionFactory.from_program(self.program)], **course_run) - for course in self.program['courses'] - for course_run in course['course_runs'] - ] - ) + self.stub_catalog_api(programs=[self.program], pathways=[]) self.cache_programs() self.details_page.visit() diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index c17995ddb9..728d1e7da5 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -814,7 +814,7 @@ class TestGetHtmlMethod(BaseTestXmodule): mocked_get_video.side_effect = side_effect - source_xml = """ + SOURCE_XML = """