diff --git a/section_to_course/api/tests/test_views.py b/section_to_course/api/tests/test_views.py index 53b0ae4..873531d 100644 --- a/section_to_course/api/tests/test_views.py +++ b/section_to_course/api/tests/test_views.py @@ -3,7 +3,7 @@ """ # pylint: disable=no-self-use -from common.djangoapps.student.tests.factories import UserFactory +from common.djangoapps.student.tests.factories import UserFactory, TEST_PASSWORD from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase @@ -54,7 +54,7 @@ def test_rejects_unauthorized(self): Test that the API rejects unauthorized users. """ user = UserFactory.create() - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) response = self.client.get( reverse('section_to_course:section_autocomplete', kwargs={'course_id': 'course-v1:edX+DemoX+Demo_Course'}) ) @@ -65,7 +65,7 @@ def test_rejects_malformed(self): Test that the API rejects malformed course IDs. """ user = UserFactory.create(is_staff=True) - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) response = self.client.get( reverse('section_to_course:section_autocomplete', kwargs={'course_id': 'malarkey'}) ) @@ -76,7 +76,7 @@ def test_handles_nonexistent(self): Test that the API rejects malformed course IDs. """ user = UserFactory.create(is_staff=True) - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) response = self.client.get( reverse('section_to_course:section_autocomplete', kwargs={'course_id': 'course-v1:edX+DemoX+Demo_Course'}), ) @@ -87,7 +87,7 @@ def test_handles_blank(self): Test that blank terms return all sections. """ user = UserFactory.create(is_staff=True) - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) create_subsections() response = self.client.get( reverse('section_to_course:section_autocomplete', kwargs={'course_id': 'course-v1:edX+DemoX+Demo_Course'}), @@ -105,7 +105,7 @@ def test_filters_existing(self): Test that autocomplete filters existing sections. """ user = UserFactory.create(is_staff=True) - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) section_data = create_subsections() SectionToCourseLinkFactory(source_course=section_data['course'], source_section=section_data['experimentation']) response = self.client.get( @@ -123,7 +123,7 @@ def test_filters_names(self): Test that autocomplete filters names. """ user = UserFactory.create(is_staff=True) - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) create_subsections() response = self.client.get( reverse('section_to_course:section_autocomplete', kwargs={'course_id': 'course-v1:edX+DemoX+Demo_Course'}) @@ -141,7 +141,7 @@ def test_filters_keys(self): Test that autocomplete filters keys. """ user = UserFactory.create(is_staff=True) - assert self.client.login(username=user.username, password='test') + assert self.client.login(username=user.username, password=TEST_PASSWORD) create_subsections() response = self.client.get( reverse('section_to_course:section_autocomplete', kwargs={'course_id': 'course-v1:edX+DemoX+Demo_Course'}) diff --git a/section_to_course/tests/test_admin.py b/section_to_course/tests/test_admin.py index ccad190..ed8fd9a 100644 --- a/section_to_course/tests/test_admin.py +++ b/section_to_course/tests/test_admin.py @@ -1,7 +1,7 @@ """ Tests for the admin views of the section_to_course app. """ -from common.djangoapps.student.tests.factories import UserFactory # pylint: disable=import-error +from common.djangoapps.student.tests.factories import UserFactory, TEST_PASSWORD # pylint: disable=import-error from django.test import TestCase from django.urls import reverse from django.utils import timezone @@ -31,7 +31,7 @@ def setUp(self): """Set up our admin test cases.""" super().setUp() user = UserFactory.create(is_staff=True, is_superuser=True) - self.client.login(username=user.username, password='test') + self.client.login(username=user.username, password=TEST_PASSWORD) def test_listing(self): """Test that the admin listing page loads."""