test: Update to reuse variables in more places.
Some of the places where we had explicit copies of the password were not necessary so we referece the exsting TEST_PASSWORD variable where possible.
This commit is contained in:
@@ -184,7 +184,7 @@ class InternationalizationTest(ModuleStoreTestCase):
|
||||
|
||||
self.uname = 'testuser'
|
||||
self.email = 'test+courses@edx.org'
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
|
||||
# Create the use so we can log them in.
|
||||
self.user = UserFactory.create(username=self.uname, email=self.email, password=self.password)
|
||||
|
||||
@@ -8,7 +8,7 @@ from datetime import datetime
|
||||
from common.djangoapps.student.tests.factories import UserFactory, CourseEnrollmentFactory, CourseAccessRoleFactory
|
||||
from xmodule.modulestore.tests.factories import ToyCourseFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
TEST_PASSWORD = 'edx'
|
||||
TEST_PASSWORD = 'Password1234'
|
||||
|
||||
|
||||
class CourseApiFactoryMixin:
|
||||
|
||||
@@ -50,7 +50,7 @@ class CourseStructureTestCase(TransformerRegistryTestMixin, ModuleStoreTestCase)
|
||||
"""
|
||||
super().setUp()
|
||||
# Set up users.
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
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 = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
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(
|
||||
|
||||
@@ -24,7 +24,7 @@ class WikiRedirectTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCas
|
||||
# Create two accounts
|
||||
self.student = 'view@test.com'
|
||||
self.instructor = 'view2@test.com'
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
for username, email in [('u1', self.student), ('u2', self.instructor)]:
|
||||
self.create_account(username, email, self.password)
|
||||
self.activate_user(email)
|
||||
|
||||
@@ -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 = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
self.create_account('u1', self.student, self.password)
|
||||
self.activate_user(self.student)
|
||||
self.enroll(self.course)
|
||||
|
||||
@@ -548,7 +548,7 @@ class CourseSubmissionHistoryWithDataTest(TestSubmittingProblems):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.namespaced_url = 'grades_api:v1:submission_history'
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
self.basic_setup()
|
||||
self.global_staff = GlobalStaffFactory.create()
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class MobileAPITestCase(ModuleStoreTestCase, APITestCase):
|
||||
certificate_available_date=datetime.datetime.now(pytz.UTC)
|
||||
)
|
||||
self.user = UserFactory.create()
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
self.username = self.user.username
|
||||
self.api_version = API_V1
|
||||
IgnoreMobileAvailableFlagConfig(enabled=False).save()
|
||||
|
||||
@@ -28,7 +28,7 @@ class SurveyModelsTests(ModuleStoreTestCase):
|
||||
self.client = Client()
|
||||
|
||||
# Create two accounts
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
self.student = UserFactory.create(
|
||||
username='student', email='student@test.com', password=self.password,
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ class SurveyViewsTests(ModuleStoreTestCase):
|
||||
self.client = Client()
|
||||
|
||||
# Create two accounts
|
||||
self.password = 'Password1234'
|
||||
self.password = self.TEST_PASSWORD
|
||||
self.student = UserFactory.create(username='student', email='student@test.com', password=self.password)
|
||||
|
||||
self.test_survey_name = 'TestSurvey'
|
||||
|
||||
@@ -93,6 +93,8 @@ l8N6+LEIVTMAytPk+/bImHvGHKZkCz5rEMSuYJWOmqKI92rUtI6fz5DUb3XSbrwT
|
||||
3W+sdGFUK3GH1NAX71VxbAlFVLUetcMwai1+wXmGkRw6A7YezVFnhw==
|
||||
-----END RSA PRIVATE KEY-----"""
|
||||
|
||||
TEST_PASSWORD = 'Password1234'
|
||||
|
||||
|
||||
def _mock_payment_processors():
|
||||
"""
|
||||
@@ -122,8 +124,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='Password1234')
|
||||
self.client.login(username="rusty", password='Password1234')
|
||||
UserFactory.create(username="rusty", password=TEST_PASSWORD)
|
||||
self.client.login(username="rusty", password=TEST_PASSWORD)
|
||||
|
||||
def must_be_logged_in(self):
|
||||
self.assertHttpForbidden(self.client.get(self.start_url())) # lint-amnesty, pylint: disable=no-member
|
||||
@@ -1055,11 +1057,11 @@ class CheckoutTestMixin:
|
||||
""" Create a user and course. """
|
||||
super().setUp()
|
||||
|
||||
self.user = UserFactory.create(username="test", password='Password1234')
|
||||
self.user = UserFactory.create(username="test", password=TEST_PASSWORD)
|
||||
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='Password1234')
|
||||
self.client.login(username="test", password=TEST_PASSWORD)
|
||||
|
||||
def _assert_checked_out(
|
||||
self,
|
||||
@@ -1868,7 +1870,7 @@ class TestPhotoURLView(TestVerificationBase):
|
||||
super().setUp()
|
||||
|
||||
self.user = AdminFactory()
|
||||
login_success = self.client.login(username=self.user.username, password='Password1234')
|
||||
login_success = self.client.login(username=self.user.username, password=TEST_PASSWORD)
|
||||
assert login_success
|
||||
self.attempt = SoftwareSecurePhotoVerification(
|
||||
status="submitted",
|
||||
@@ -1895,7 +1897,7 @@ class TestPhotoURLView(TestVerificationBase):
|
||||
|
||||
def test_403_for_non_staff(self):
|
||||
self.user = UserFactory()
|
||||
login_success = self.client.login(username=self.user.username, password='Password1234')
|
||||
login_success = self.client.login(username=self.user.username, password=TEST_PASSWORD)
|
||||
assert login_success
|
||||
url = reverse('verification_photo_urls', kwargs={'receipt_id': str(self.receipt_id)})
|
||||
response = self.client.get(url)
|
||||
@@ -1934,7 +1936,7 @@ class TestDecodeImageViews(MockS3Boto3Mixin, TestVerificationBase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.user = AdminFactory()
|
||||
login_success = self.client.login(username=self.user.username, password='Password1234')
|
||||
login_success = self.client.login(username=self.user.username, password=TEST_PASSWORD)
|
||||
assert login_success
|
||||
|
||||
def _mock_submit_images(self):
|
||||
@@ -1995,7 +1997,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='Password1234')
|
||||
login_success = self.client.login(username=self.user.username, password=TEST_PASSWORD)
|
||||
assert login_success
|
||||
|
||||
self._mock_submit_images()
|
||||
|
||||
@@ -21,8 +21,8 @@ class TestCrowdsourceHinter(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
Create the test environment with the crowdsourcehinter xblock.
|
||||
"""
|
||||
STUDENTS = [
|
||||
{'email': 'view@test.com', 'password': 'Password1234'},
|
||||
{'email': 'view2@test.com', 'password': 'Password1234'}
|
||||
{'email': 'view@test.com', 'password': SharedModuleStoreTestCase.TEST_PASSWORD},
|
||||
{'email': 'view2@test.com', 'password': SharedModuleStoreTestCase.TEST_PASSWORD}
|
||||
]
|
||||
XBLOCK_NAMES = ['crowdsourcehinter']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user