Skip to content

Commit

Permalink
refactor: fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Oct 11, 2023
1 parent c0dc16b commit 8668276
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lms/djangoapps/bulk_email/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class BulkEmailTargetChoices:
SEND_TO_TRACK = "track"
SEND_TO_INDIVIDUAL_LEARNERS = "individual-learners"

TARGET_CHOICES = (SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS)
TARGET_CHOICES = (
SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS,
)

@classmethod
def is_valid_target(cls, target):
Expand Down
9 changes: 8 additions & 1 deletion lms/djangoapps/bulk_email/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ class Meta:
SEND_TO_INDIVIDUAL_LEARNERS = 'individual-learners'
EMAIL_TARGET_CHOICES = list(zip(
[SEND_TO_MYSELF, SEND_TO_STAFF, SEND_TO_LEARNERS, SEND_TO_COHORT, SEND_TO_TRACK, SEND_TO_INDIVIDUAL_LEARNERS],
['Myself', 'Staff and instructors', 'All students', 'Specific cohort', 'Specific course mode', 'Specific list of students']
[
'Myself',
'Staff and instructors',
'All students',
'Specific cohort',
'Specific course mode',
'Specific list of students',
]
))
EMAIL_TARGETS = {target[0] for target in EMAIL_TARGET_CHOICES}

Expand Down
12 changes: 10 additions & 2 deletions lms/djangoapps/instructor/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,15 @@ def setUp(self):
('update_forum_role_membership',
{'unique_student_identifier': self.user.email, 'rolename': 'Moderator', 'action': 'allow'}),
('list_forum_members', {'rolename': FORUM_ROLE_COMMUNITY_TA}),
('send_email', {'send_to': '["staff"]', 'individual_learners_emails': '[]' ,'subject': 'test', 'message': 'asdf'}),
(
'send_email',
{
'send_to': '["staff"]',
'individual_learners_emails': '[]',
'subject': 'test',
'message': 'asdf',
}
),
('list_instructor_tasks', {}),
('instructor_api_v1:list_instructor_tasks', {}),
('list_background_email_tasks', {}),
Expand Down Expand Up @@ -3531,7 +3539,7 @@ def test_send_email_with_schedule(self, mock_task_api):
response = self.client.post(url, self.full_test_message)

assert response.status_code == 200
_, _, _, arg_schedule, _ = mock_task_api.call_args.args
_, _, _, arg_schedule, _ = mock_task_api.call_args.args
assert arg_schedule == expected_schedule

@patch("lms.djangoapps.instructor.views.api.task_api.submit_bulk_course_email")
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor_task/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def submit_delete_entrance_exam_state_for_student(request, usage_key, student):
return submit_task(request, task_type, task_class, usage_key.course_key, task_input, task_key)


def submit_bulk_course_email(request, course_key, email_id, schedule=None, individual_emails=[]):
def submit_bulk_course_email(request, course_key, email_id, schedule=None, individual_emails=None):
"""
Request to have bulk email sent as a background task.
Expand Down

0 comments on commit 8668276

Please sign in to comment.