diff --git a/common/test/test_microsites/microsite_with_logistration/readme.txt b/common/test/test_microsites/microsite_with_logistration/readme.txt new file mode 100644 index 0000000000..4a104e4370 --- /dev/null +++ b/common/test/test_microsites/microsite_with_logistration/readme.txt @@ -0,0 +1 @@ +# This is intentionally an empty directory. This is needed for this test microsite to be valid diff --git a/lms/djangoapps/student_account/test/test_views.py b/lms/djangoapps/student_account/test/test_views.py index 7997da12a7..6ade2ffda6 100644 --- a/lms/djangoapps/student_account/test/test_views.py +++ b/lms/djangoapps/student_account/test/test_views.py @@ -459,3 +459,60 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase): for attribute in self.FIELDS: self.assertIn(attribute, response.content) + + +@override_settings(SITE_NAME=settings.MICROSITE_LOGISTRATION_HOSTNAME) +class MicrositeLogistrationTests(TestCase): + """ + Test to validate that microsites can display the logistration page + """ + + def test_login_page(self): + """ + Make sure that we get the expected logistration page on our specialized + microsite + """ + + resp = self.client.get( + reverse('account_login'), + HTTP_HOST=settings.MICROSITE_LOGISTRATION_HOSTNAME + ) + self.assertEqual(resp.status_code, 200) + + self.assertIn('
This is a Logistration HTML", + "ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER": False, + "COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog", + "COURSE_ABOUT_VISIBILITY_PERMISSION": "see_about_page", + "ENABLE_SHOPPING_CART": True, + "ENABLE_PAID_COURSE_REGISTRATION": True, + "SESSION_COOKIE_DOMAIN": "test_logistration.localhost", + }, "default": { "university": "default_university", "domain_prefix": "www", @@ -422,6 +447,7 @@ MICROSITE_CONFIGURATION = { } MICROSITE_ROOT_DIR = COMMON_ROOT / 'test' / 'test_microsites' MICROSITE_TEST_HOSTNAME = 'testmicrosite.testserver' +MICROSITE_LOGISTRATION_HOSTNAME = 'logistration.testserver' FEATURES['USE_MICROSITES'] = True diff --git a/lms/lib/courseware_search/test/test_lms_filter_generator.py b/lms/lib/courseware_search/test/test_lms_filter_generator.py index 3e18bf5ac4..479b1350f7 100644 --- a/lms/lib/courseware_search/test/test_lms_filter_generator.py +++ b/lms/lib/courseware_search/test/test_lms_filter_generator.py @@ -102,12 +102,16 @@ class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase): self.assertEqual(0, len(field_dictionary['course'])) def test_excludes_microsite(self): - """ By default there is the test microsite to exclude """ + """ + By default there is the test microsite and the microsite with logistration + to exclude + """ _, _, exclude_dictionary = LmsSearchFilterGenerator.generate_field_filters(user=self.user) self.assertIn('org', exclude_dictionary) exclude_orgs = exclude_dictionary['org'] - self.assertEqual(1, len(exclude_orgs)) - self.assertEqual('TestMicrositeX', exclude_orgs[0]) + self.assertEqual(2, len(exclude_orgs)) + self.assertEqual('LogistrationX', exclude_orgs[0]) + self.assertEqual('TestMicrositeX', exclude_orgs[1]) @patch('microsite_configuration.microsite.get_all_orgs', Mock(return_value=[])) def test_excludes_no_microsite(self):