|
5 | 5 |
|
6 | 6 | import ddt |
7 | 7 | from django.conf import settings |
| 8 | +from django.test import override_settings |
8 | 9 |
|
9 | 10 | from openedx.core.djangoapps.content.course_overviews.models import CourseOverview |
10 | 11 | from common.djangoapps.util.course import get_link_for_about_page |
@@ -51,17 +52,18 @@ def get_course_sharing_link(self, enable_social_sharing, enable_mktg_site, use_o |
51 | 52 | """ |
52 | 53 | mock_settings = { |
53 | 54 | 'FEATURES': { |
54 | | - 'ENABLE_MKTG_SITE': enable_mktg_site |
| 55 | + 'ENABLE_MKTG_SITE': enable_mktg_site, |
55 | 56 | }, |
56 | 57 | 'SOCIAL_SHARING_SETTINGS': { |
57 | 58 | 'CUSTOM_COURSE_URLS': enable_social_sharing |
58 | | - }, |
| 59 | + } |
59 | 60 | } |
60 | 61 |
|
61 | | - with mock.patch.multiple('django.conf.settings', **mock_settings): |
62 | | - course_sharing_link = get_link_for_about_page( |
63 | | - self.course_overview if use_overview else self.course |
64 | | - ) |
| 62 | + with override_settings(ENABLE_CATALOG_MICROFRONTEND=False): |
| 63 | + with mock.patch.multiple('django.conf.settings', **mock_settings): |
| 64 | + course_sharing_link = get_link_for_about_page( |
| 65 | + self.course_overview if use_overview else self.course |
| 66 | + ) |
65 | 67 |
|
66 | 68 | return course_sharing_link |
67 | 69 |
|
@@ -126,3 +128,24 @@ def test_sharing_link_with_course_block(self, enable_social_sharing, expected_co |
126 | 128 | use_overview=False, |
127 | 129 | ) |
128 | 130 | assert actual_course_sharing_link == expected_course_sharing_link |
| 131 | + |
| 132 | + @ddt.data( |
| 133 | + ( |
| 134 | + True, |
| 135 | + f'{settings.CATALOG_MICROFRONTEND_URL}/courses/course-v1:test_org+test_number+test_run/about' |
| 136 | + ), |
| 137 | + ( |
| 138 | + False, |
| 139 | + f'{settings.LMS_ROOT_URL}/courses/course-v1:test_org+test_number+test_run/about' |
| 140 | + ) |
| 141 | + ) |
| 142 | + @ddt.unpack |
| 143 | + def test_sharing_link_with_new_course_about_page( |
| 144 | + self, catalog_mfe_enabled, expected_course_sharing_link |
| 145 | + ): |
| 146 | + """ |
| 147 | + Verify the method gives correct course sharing url when new course about page is used. |
| 148 | + """ |
| 149 | + with override_settings(ENABLE_CATALOG_MICROFRONTEND=catalog_mfe_enabled): |
| 150 | + actual_course_sharing_link = get_link_for_about_page(self.course_overview) |
| 151 | + assert actual_course_sharing_link == expected_course_sharing_link |
0 commit comments