Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ilee2u committed Aug 26, 2024
1 parent c57ec82 commit 9906ec8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
1 change: 0 additions & 1 deletion lms/djangoapps/verify_student/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def create_verification_attempt(user, name, status, expiration_datetime=None):
expiration_datetime=expiration_datetime,
)


return verification_attempt.id


Expand Down
1 change: 1 addition & 0 deletions lms/djangoapps/verify_student/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
class WindowExpiredException(Exception):
pass


class VerificationAttemptInvalidStatus(Exception):
pass
58 changes: 29 additions & 29 deletions lms/djangoapps/verify_student/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def setUp(self):

self.user = UserFactory.create()
self.attempt = SoftwareSecurePhotoVerification(
status="submitted",
user=self.user
status = "submitted",
user = self.user
)
self.attempt.save()

Expand Down Expand Up @@ -62,42 +62,42 @@ def setUp(self):

self.user = UserFactory.create()
self.attempt = VerificationAttempt(
user=self.user,
name='Tester McTest',
status=VerificationAttemptStatus.created,
expiration_datetime=datetime(2024, 12, 31, tzinfo=timezone.utc)
user = self.user,
name = 'Tester McTest',
status = VerificationAttemptStatus.created,
expiration_datetime = datetime(2024, 12, 31, tzinfo = timezone.utc)
)
self.attempt.save()

def test_create_verification_attempt(self):
expected_id = 2
self.assertEqual(
create_verification_attempt(
user=self.user,
name='Tester McTest',
status=VerificationAttemptStatus.created,
expiration_datetime=datetime(2024, 12, 31, tzinfo=timezone.utc)
user = self.user,
name = 'Tester McTest',
status = VerificationAttemptStatus.created,
expiration_datetime = datetime(2024, 12, 31, tzinfo = timezone.utc)
),
expected_id
)
verification_attempt = VerificationAttempt.objects.get(id=expected_id)
verification_attempt = VerificationAttempt.objects.get(id = expected_id)

self.assertEqual(verification_attempt.user, self.user)
self.assertEqual(verification_attempt.name, 'Tester McTest')
self.assertEqual(verification_attempt.status, VerificationAttemptStatus.created)
self.assertEqual(verification_attempt.expiration_datetime, datetime(2024, 12, 31, tzinfo=timezone.utc))
self.assertEqual(verification_attempt.expiration_datetime, datetime(2024, 12, 31, tzinfo = timezone.utc))

def test_create_verification_attempt_no_expiration_datetime(self):
expected_id = 2
self.assertEqual(
create_verification_attempt(
user=self.user,
name='Tester McTest',
status=VerificationAttemptStatus.created,
user = self.user,
name = 'Tester McTest',
status = VerificationAttemptStatus.created,
),
expected_id
)
verification_attempt = VerificationAttempt.objects.get(id=expected_id)
verification_attempt = VerificationAttempt.objects.get(id = expected_id)

self.assertEqual(verification_attempt.user, self.user)
self.assertEqual(verification_attempt.name, 'Tester McTest')
Expand All @@ -114,12 +114,12 @@ class UpdateVerificationAttemptStatus(TestCase):
def setUp(self):
super().setUp()

self.user= UserFactory.create()
self.attempt= VerificationAttempt(
user=self.user,
name='Tester McTest',
status=VerificationAttemptStatus.created,
expiration_datetime=datetime(2024, 12, 31, tzinfo=timezone.utc)
self.user = UserFactory.create()
self.attempt = VerificationAttempt(
user = self.user,
name = 'Tester McTest',
status = VerificationAttemptStatus.created,
expiration_datetime = datetime(2024, 12, 31, tzinfo = timezone.utc)
)
self.attempt.save()

Expand All @@ -129,14 +129,14 @@ def setUp(self):
VerificationAttemptStatus.denied,
)
def test_update_verification_attempt_status(self, to_status):
update_verification_attempt_status(attempt_id=self.attempt.id, status=to_status)
update_verification_attempt_status(attempt_id = self.attempt.id, status = to_status)

verification_attempt = VerificationAttempt.objects.get(id=self.attempt.id)
verification_attempt = VerificationAttempt.objects.get(id = self.attempt.id)

# These are fields whose values should not change as a result of this update.
self.assertEqual(verification_attempt.user, self.user)
self.assertEqual(verification_attempt.name, 'Tester McTest')
self.assertEqual(verification_attempt.expiration_datetime, datetime(2024, 12, 31, tzinfo=timezone.utc))
self.assertEqual(verification_attempt.expiration_datetime, datetime(2024, 12, 31, tzinfo = timezone.utc))

# This field's value should change as a result of this update.
self.assertEqual(verification_attempt.status, to_status)
Expand All @@ -153,14 +153,14 @@ def test_update_verification_attempt_status_invalid(self, to_status):
self.assertRaises(
VerificationAttemptInvalidStatus,
update_verification_attempt_status,
attempt_id=self.attempt.id,
status=to_status,
attempt_id = self.attempt.id,
status = to_status,
)

def test_update_verification_attempt_status_not_found(self):
self.assertRaises(
VerificationAttempt.DoesNotExist,
update_verification_attempt_status,
attempt_id=999999,
status=VerificationAttemptStatus.approved,
attempt_id = 999999,
status = VerificationAttemptStatus.approved,
)

0 comments on commit 9906ec8

Please sign in to comment.