test: Update to an even longer password.

This commit is contained in:
Feanil Patel
2023-10-11 13:44:09 -04:00
parent 1e2ea85372
commit 64e91d4080
47 changed files with 88 additions and 88 deletions

View File

@@ -33,7 +33,7 @@ from lms.djangoapps.instructor.access import allow_access, list_with_level
from lms.djangoapps.instructor.enrollment import enroll_email, get_email_params
from openedx.core.lib.courses import get_course_by_id
USER_PASSWORD = 'password'
USER_PASSWORD = 'Password1234'
class CcxRestApiTest(CcxTestCase, APITestCase):

View File

@@ -129,7 +129,7 @@ class TestAdminAccessCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
ccx = self.make_ccx()
ccx_key = CCXLocator.from_course_locator(self.course.id, ccx.id)
self.url = reverse('ccx_coach_dashboard', kwargs={'course_id': ccx_key})
self.TEST_PASSWORD = 'password'
self.TEST_PASSWORD = 'Password1234'
def test_staff_access_coach_dashboard(self):
"""

View File

@@ -23,7 +23,7 @@ from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, p
from ....tests.mocks import mock_order_endpoint
from ....tests.test_views import UserMixin
PASSWORD = 'password'
PASSWORD = 'Password1234'
JSON_CONTENT_TYPE = 'application/json'

View File

@@ -3,7 +3,7 @@
from common.djangoapps.student.tests.factories import UserFactory
TEST_PASSWORD = "password"
TEST_PASSWORD = "Password1234"
class UserMixin:

View File

@@ -50,7 +50,7 @@ class CourseStructureTestCase(TransformerRegistryTestMixin, ModuleStoreTestCase)
"""
super().setUp()
# Set up users.
self.password = 'password'
self.password = 'Password1234'
self.user = UserFactory.create(password=self.password)
self.staff = UserFactory.create(password=self.password, is_staff=True)
@@ -253,7 +253,7 @@ class BlockParentsMapTestCase(TransformerRegistryTestMixin, ModuleStoreTestCase)
parent_block.children.append(self.xblock_keys[i])
update_block(parent_block)
self.password = 'password'
self.password = 'Password1234'
self.student = UserFactory.create(is_staff=False, username='test_student', password=self.password)
self.staff = UserFactory.create(is_staff=True, username='test_staff', password=self.password)
CourseEnrollmentFactory.create(

View File

@@ -24,7 +24,7 @@ class WikiRedirectTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCas
# Create two accounts
self.student = 'view@test.com'
self.instructor = 'view2@test.com'
self.password = 'password'
self.password = 'Password1234'
for username, email in [('u1', self.student), ('u2', self.instructor)]:
self.create_account(username, email, self.password)
self.activate_user(email)

View File

@@ -173,7 +173,7 @@ class LoginEnrollmentTestCase(TestCase):
Create a user account, activate, and log in.
"""
self.email = 'foo@test.com' # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.password = 'password' # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.password = 'Password1234' # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.username = 'test' # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.user = self.create_account(
self.username,

View File

@@ -284,7 +284,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, SharedModuleSt
# pylint: disable=attribute-defined-outside-init
# create a new account since the first account is already enrolled in the course
self.email = 'foo_second@test.com'
self.password = 'password'
self.password = 'Password1234'
self.username = 'test_second'
self.create_account(self.username, self.email, self.password)
self.activate_user(self.email)

View File

@@ -22,7 +22,7 @@ class SurveyViewsTests(LoginEnrollmentTestCase, SharedModuleStoreTestCase, XssTe
"""
All tests for the views.py file
"""
STUDENT_INFO = [('view@test.com', 'password1234')]
STUDENT_INFO = [('view@test.com', 'Password1234')]
@classmethod
def setUpClass(cls):

View File

@@ -154,7 +154,7 @@ class TestSubmittingProblems(ModuleStoreTestCase, LoginEnrollmentTestCase, Probl
# create a test student
self.course = CourseFactory.create(display_name=self.COURSE_NAME, number=self.COURSE_SLUG)
self.student = 'view@test.com'
self.password = 'password'
self.password = 'Password1234'
self.create_account('u1', self.student, self.password)
self.activate_user(self.student)
self.enroll(self.course)

View File

@@ -29,7 +29,7 @@ class TestViewAuth(EnterpriseTestConsentRequired, ModuleStoreTestCase, LoginEnro
Check that view authentication works properly.
"""
ACCOUNT_INFO = [('view@test.com', 'password1234'), ('view2@test.com', 'password1234')]
ACCOUNT_INFO = [('view@test.com', 'Password1234'), ('view2@test.com', 'Password1234')]
ENABLED_SIGNALS = ['course_published']
@staticmethod

View File

@@ -81,7 +81,7 @@ class RenderXBlockTestMixin(MasqueradeMixin, metaclass=ABCMeta):
"""
Logs in the test user.
"""
self.client.login(username=self.user.username, password='password')
self.client.login(username=self.user.username, password='Password1234')
def course_options(self):
"""

View File

@@ -241,7 +241,7 @@ class ViewsTestCaseMixin:
with patch('common.djangoapps.student.models.user.cc.User.save'):
uname = 'student'
email = 'student@edx.org'
self.password = 'password'
self.password = 'Password1234'
# Create the user and make them active so we can log them in.
self.student = UserFactory.create(username=uname, email=email, password=self.password)
@@ -464,7 +464,7 @@ class ViewsTestCase(
with patch('common.djangoapps.student.models.user.cc.User.save'):
uname = 'student'
email = 'student@edx.org'
self.password = 'password'
self.password = 'Password1234'
# Create the user and make them active so we can log them in.
self.student = UserFactory.create(username=uname, email=email, password=self.password)

View File

@@ -87,7 +87,7 @@ class DiscussionAPIViewTestMixin(ForumsEnableMixin, CommentsServiceMockMixin, Ur
start=datetime.now(UTC),
discussion_topics={"Test Topic": {"id": "test_topic"}}
)
self.password = "password"
self.password = "Password1234"
self.user = UserFactory.create(password=self.password)
# Ensure that parental controls don't apply to this user
self.user.profile.year_of_birth = 1970
@@ -168,7 +168,7 @@ class UploadFileViewTest(ForumsEnableMixin, CommentsServiceMockMixin, UrlResetMi
content_type="image/jpeg",
),
}
self.user = UserFactory.create(password="password")
self.user = UserFactory.create(password=self.TEST_PASSWORD)
self.course = CourseFactory.create(org='a', course='b', run='c', start=datetime.now(UTC))
self.url = reverse("upload_file", kwargs={"course_id": str(self.course.id)})
@@ -176,7 +176,7 @@ class UploadFileViewTest(ForumsEnableMixin, CommentsServiceMockMixin, UrlResetMi
"""
Authenticates the test client with the example user.
"""
self.client.login(username=self.user.username, password="password")
self.client.login(username=self.user.username, password=self.TEST_PASSWORD)
def enroll_user_in_course(self):
"""
@@ -320,10 +320,10 @@ class CommentViewSetListByUserTest(
self.addCleanup(httpretty.reset)
self.addCleanup(httpretty.disable)
self.user = UserFactory.create(password="password")
self.user = UserFactory.create(password=self.TEST_PASSWORD)
self.register_get_user_response(self.user)
self.other_user = UserFactory.create(password="password")
self.other_user = UserFactory.create(password=self.TEST_PASSWORD)
self.register_get_user_response(self.other_user)
self.course = CourseFactory.create(org="a", course="b", run="c", start=datetime.now(UTC))
@@ -405,7 +405,7 @@ class CommentViewSetListByUserTest(
they're not either enrolled or staff members.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
response = self.client.get(self.url)
assert response.status_code == status.HTTP_404_NOT_FOUND
assert json.loads(response.content)["developer_message"] == "Course not found."
@@ -416,7 +416,7 @@ class CommentViewSetListByUserTest(
comments in that course.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
CourseEnrollmentFactory.create(user=self.other_user, course_id=self.course.id)
self.assert_successful_response(self.client.get(self.url))
@@ -425,7 +425,7 @@ class CommentViewSetListByUserTest(
Staff users are allowed to get any user's comments.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
GlobalStaff().add_users(self.other_user)
self.assert_successful_response(self.client.get(self.url))
@@ -436,7 +436,7 @@ class CommentViewSetListByUserTest(
course.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
role(course_key=self.course.id).add_users(self.other_user)
self.assert_successful_response(self.client.get(self.url))
@@ -445,7 +445,7 @@ class CommentViewSetListByUserTest(
Requests for users that don't exist result in a 404 response.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
GlobalStaff().add_users(self.other_user)
url = self.build_url("non_existent", self.course.id)
response = self.client.get(url)
@@ -456,7 +456,7 @@ class CommentViewSetListByUserTest(
Requests for courses that don't exist result in a 404 response.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
GlobalStaff().add_users(self.other_user)
url = self.build_url(self.user.username, "course-v1:x+y+z")
response = self.client.get(url)
@@ -467,7 +467,7 @@ class CommentViewSetListByUserTest(
Requests with invalid course ID should fail form validation.
"""
self.register_mock_endpoints()
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
GlobalStaff().add_users(self.other_user)
url = self.build_url(self.user.username, "an invalid course")
response = self.client.get(url)
@@ -484,7 +484,7 @@ class CommentViewSetListByUserTest(
self.register_get_threads_response(threads=[], page=1, num_pages=1)
self.register_get_comments_response(comments=[], page=1, num_pages=1)
self.client.login(username=self.other_user.username, password="password")
self.client.login(username=self.other_user.username, password=self.TEST_PASSWORD)
GlobalStaff().add_users(self.other_user)
url = self.build_url(self.user.username, self.course.id, page=2)
response = self.client.get(url)
@@ -929,7 +929,7 @@ class CourseTopicsViewV3Test(DiscussionAPIViewTestMixin, CommentsServiceMockMixi
"""
def setUp(self) -> None:
super().setUp()
self.password = "password"
self.password = self.TEST_PASSWORD
self.user = UserFactory.create(password=self.password)
self.client.login(username=self.user.username, password=self.password)
self.staff = AdminFactory.create()
@@ -2758,7 +2758,7 @@ class CourseDiscussionSettingsAPIViewTest(APITestCase, UrlResetMixin, ModuleStor
discussion_topics={"Test Topic": {"id": "test_topic"}}
)
self.path = reverse('discussion_course_settings', kwargs={'course_id': str(self.course.id)})
self.password = 'password'
self.password = self.TEST_PASSWORD
self.user = UserFactory(username='staff', password=self.password, is_staff=True)
def _get_oauth_headers(self, user):
@@ -3056,7 +3056,7 @@ class CourseDiscussionRolesAPIViewTest(APITestCase, UrlResetMixin, ModuleStoreTe
run="z",
start=datetime.now(UTC),
)
self.password = 'password'
self.password = self.TEST_PASSWORD
self.user = UserFactory(username='staff', password=self.password, is_staff=True)
course_key = CourseKey.from_string('course-v1:x+y+z')
seed_permissions_roles(course_key)
@@ -3264,7 +3264,7 @@ class CourseActivityStatsTest(ForumsEnableMixin, UrlResetMixin, CommentsServiceM
user = UserFactory.create(
username=stat['username'],
email=f"{stat['username']}@example.com",
password='12345'
password=self.TEST_PASSWORD
)
CourseEnrollment.enroll(user, self.course.id, mode='audit')

View File

@@ -97,7 +97,7 @@ class GradeViewTestMixin(SharedModuleStoreTestCase):
def setUp(self):
super().setUp()
self.password = 'password'
self.password = self.TEST_PASSWORD
self.global_staff = GlobalStaffFactory.create()
self.student = UserFactory(password=self.password, username='student', email='student@example.com')
self.other_student = UserFactory(

View File

@@ -548,7 +548,7 @@ class CourseSubmissionHistoryWithDataTest(TestSubmittingProblems):
def setUp(self):
super().setUp()
self.namespaced_url = 'grades_api:v1:submission_history'
self.password = 'password'
self.password = 'Password1234'
self.basic_setup()
self.global_staff = GlobalStaffFactory.create()

View File

@@ -26,7 +26,7 @@ class TestRecommendationsBase(APITestCase):
def setUp(self):
super().setUp()
self.TEST_PASSWORD = 'password'
self.TEST_PASSWORD = 'Password1234'
self.user = UserFactory(password=self.TEST_PASSWORD)
self.client.login(username=self.user.username, password=self.TEST_PASSWORD)
self.recommended_courses = [
@@ -164,7 +164,7 @@ class TestRecommendationsContextView(APITestCase):
def setUp(self):
super().setUp()
self.user = UserFactory()
self.password = "password"
self.password = 'Password1234'
self.url = reverse_lazy("learner_recommendations:recommendations_context")
@mock.patch("lms.djangoapps.learner_recommendations.views.country_code_from_ip")
@@ -370,7 +370,7 @@ class TestProductRecommendationsView(APITestCase):
def setUp(self):
super().setUp()
self.TEST_PASSWORD = 'password'
self.TEST_PASSWORD = 'Password1234'
self.user = UserFactory(password=self.TEST_PASSWORD)
self.client.login(username=self.user.username, password=self.TEST_PASSWORD)
self.associated_course_keys = ["edx+HL1", "edx+HL2"]

View File

@@ -50,7 +50,7 @@ class MobileAPITestCase(ModuleStoreTestCase, APITestCase):
certificate_available_date=datetime.datetime.now(pytz.UTC)
)
self.user = UserFactory.create()
self.password = 'password'
self.password = 'Password1234'
self.username = self.user.username
self.api_version = API_V1
IgnoreMobileAvailableFlagConfig(enabled=False).save()

View File

@@ -30,7 +30,7 @@ class SurveyModelsTests(TestCase):
self.client = Client()
# Create two accounts
self.password = 'password'
self.password = 'Password1234'
self.student = UserFactory.create(
username='student', email='student@test.com', password=self.password,
)

View File

@@ -28,7 +28,7 @@ class SurveyModelsTests(ModuleStoreTestCase):
self.client = Client()
# Create two accounts
self.password = 'password'
self.password = 'Password1234'
self.student = UserFactory.create(
username='student', email='student@test.com', password=self.password,
)

View File

@@ -29,7 +29,7 @@ class SurveyViewsTests(ModuleStoreTestCase):
self.client = Client()
# Create two accounts
self.password = 'password'
self.password = 'Password1234'
self.student = UserFactory.create(username='student', email='student@test.com', password=self.password)
self.test_survey_name = 'TestSurvey'

View File

@@ -122,8 +122,8 @@ class StartView(TestCase):
Test the case where the user has no pending `PhotoVerificationAttempts`,
but is just starting their first.
"""
UserFactory.create(username="rusty", password="password")
self.client.login(username="rusty", password="password")
UserFactory.create(username="rusty", password='Password1234')
self.client.login(username="rusty", password='Password1234')
def must_be_logged_in(self):
self.assertHttpForbidden(self.client.get(self.start_url())) # lint-amnesty, pylint: disable=no-member
@@ -1055,11 +1055,11 @@ class CheckoutTestMixin:
""" Create a user and course. """
super().setUp()
self.user = UserFactory.create(username="test", password="password")
self.user = UserFactory.create(username="test", password='Password1234')
self.course = CourseFactory.create()
for mode, min_price in (('audit', 0), ('honor', 0), ('verified', 100)):
CourseModeFactory.create(mode_slug=mode, course_id=self.course.id, min_price=min_price, sku=self.make_sku())
self.client.login(username="test", password="password")
self.client.login(username="test", password='Password1234')
def _assert_checked_out(
self,
@@ -1868,7 +1868,7 @@ class TestPhotoURLView(TestVerificationBase):
super().setUp()
self.user = AdminFactory()
login_success = self.client.login(username=self.user.username, password='password')
login_success = self.client.login(username=self.user.username, password='Password1234')
assert login_success
self.attempt = SoftwareSecurePhotoVerification(
status="submitted",
@@ -1895,7 +1895,7 @@ class TestPhotoURLView(TestVerificationBase):
def test_403_for_non_staff(self):
self.user = UserFactory()
login_success = self.client.login(username=self.user.username, password='password')
login_success = self.client.login(username=self.user.username, password='Password1234')
assert login_success
url = reverse('verification_photo_urls', kwargs={'receipt_id': str(self.receipt_id)})
response = self.client.get(url)
@@ -1934,7 +1934,7 @@ class TestDecodeImageViews(MockS3Boto3Mixin, TestVerificationBase):
def setUp(self):
super().setUp()
self.user = AdminFactory()
login_success = self.client.login(username=self.user.username, password='password')
login_success = self.client.login(username=self.user.username, password='Password1234')
assert login_success
def _mock_submit_images(self):
@@ -1995,7 +1995,7 @@ class TestDecodeImageViews(MockS3Boto3Mixin, TestVerificationBase):
@ddt.data("face", "photo_id")
def test_403_for_non_staff(self, img_type):
self.user = UserFactory()
login_success = self.client.login(username=self.user.username, password='password')
login_success = self.client.login(username=self.user.username, password='Password1234')
assert login_success
self._mock_submit_images()