From 835cc0871c6c4bb418660b7e8e753f80b96a7e75 Mon Sep 17 00:00:00 2001 From: Clinton Blackburn Date: Tue, 25 Jul 2017 14:56:27 -0400 Subject: [PATCH] Removed usage of LogoutViewConfiguration This model will soon be deleted. LEARNER-2042 --- common/djangoapps/student/admin.py | 2 -- common/djangoapps/student/models.py | 2 +- common/djangoapps/student/tests/test_views.py | 17 +---------------- common/djangoapps/student/views.py | 3 +-- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/common/djangoapps/student/admin.py b/common/djangoapps/student/admin.py index f30b9fd507..abc62219f5 100644 --- a/common/djangoapps/student/admin.py +++ b/common/djangoapps/student/admin.py @@ -15,7 +15,6 @@ from student.models import ( CourseEnrollmentAllowed, DashboardConfiguration, LinkedInAddToProfileConfiguration, - LogoutViewConfiguration, PendingNameChange, Registration, RegistrationCookieConfiguration, @@ -203,7 +202,6 @@ admin.site.register(CourseEnrollmentAllowed) admin.site.register(Registration) admin.site.register(PendingNameChange) admin.site.register(DashboardConfiguration, ConfigurationModelAdmin) -admin.site.register(LogoutViewConfiguration, ConfigurationModelAdmin) admin.site.register(RegistrationCookieConfiguration, ConfigurationModelAdmin) diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 8479208494..96d325d1a7 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -2469,7 +2469,7 @@ class UserAttribute(TimeStampedModel): class LogoutViewConfiguration(ConfigurationModel): - """ Configuration for the logout view. """ + """ DEPRECATED: Configuration for the logout view. """ def __unicode__(self): """Unicode representation of the instance. """ diff --git a/common/djangoapps/student/tests/test_views.py b/common/djangoapps/student/tests/test_views.py index 8ccd12ee02..5cd9a8d340 100644 --- a/common/djangoapps/student/tests/test_views.py +++ b/common/djangoapps/student/tests/test_views.py @@ -18,7 +18,7 @@ from pyquery import PyQuery as pq from student.cookies import get_user_info_cookie_data from student.helpers import DISABLE_UNENROLL_CERT_STATES -from student.models import CourseEnrollment, LogoutViewConfiguration, UserProfile +from student.models import CourseEnrollment, UserProfile from student.tests.factories import CourseEnrollmentFactory, UserFactory from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase @@ -126,7 +126,6 @@ class LogoutTests(TestCase): super(LogoutTests, self).setUp() self.user = UserFactory() self.client.login(username=self.user.username, password=PASSWORD) - LogoutViewConfiguration.objects.create(enabled=True) def create_oauth_client(self): """ Creates a trusted OAuth client. """ @@ -171,20 +170,6 @@ class LogoutTests(TestCase): response = self.client.get(url) self.assertRedirects(response, '/courses', fetch_redirect_response=False) - def test_switch_default(self): - """ Verify the IDA logout functionality is disabled if the associated switch is disabled. """ - LogoutViewConfiguration.objects.create(enabled=False) - oauth_client = self.create_oauth_client() - self.authenticate_with_oauth(oauth_client) - self.assert_logout_redirects_to_root() - - def test_switch_with_redirect_url(self): - """ Verify the IDA logout functionality is disabled if the associated switch is disabled. """ - LogoutViewConfiguration.objects.create(enabled=False) - oauth_client = self.create_oauth_client() - self.authenticate_with_oauth(oauth_client) - self.assert_logout_redirects_with_target() - def test_without_session_value(self): """ Verify logout works even if the session does not contain an entry with the authenticated OpenID Connect clients.""" diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index a1d24d0b2c..3ac0e6c579 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -108,7 +108,6 @@ from student.models import ( DashboardConfiguration, LinkedInAddToProfileConfiguration, LoginFailures, - LogoutViewConfiguration, ManualEnrollmentAudit, PasswordHistory, PendingEmailChange, @@ -2871,7 +2870,7 @@ class LogoutView(TemplateView): logout(request) # If we don't need to deal with OIDC logouts, just redirect the user. - if LogoutViewConfiguration.current().enabled and self.oauth_client_ids: + if self.oauth_client_ids: response = super(LogoutView, self).dispatch(request, *args, **kwargs) else: response = redirect(self.target)