-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from ssciolla/issue-36-strip-whitespace
Strip whitespace characters from Canvas login_id values (#36)
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,30 @@ | |
} | ||
} | ||
], | ||
"Potions_Placement_3": [ | ||
{ | ||
"id": 123461, | ||
"attempt": 1, | ||
"score": 450.0, | ||
"submitted_at": "2020-06-15T21:00:00Z", | ||
"assignment_id": 111112, | ||
"graded_at": "2020-06-15T21:30:00Z", | ||
"user": { | ||
"login_id": " [email protected] " | ||
} | ||
}, | ||
{ | ||
"id": 123462, | ||
"attempt": 1, | ||
"score": 375.0, | ||
"submitted_at": "2020-06-16T01:15:00Z", | ||
"assignment_id": 111112, | ||
"graded_at": "2020-06-16T12:01:00Z", | ||
"user": { | ||
"login_id": "\t[email protected]\n" | ||
} | ||
} | ||
], | ||
"Potions_Validation_1": [ | ||
{ | ||
"id": 444444, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ def setUp(self): | |
self.canvas_potions_val_subs: List[Dict[str, Any]] = canvas_subs_dict['Potions_Validation_1'] | ||
self.canvas_dada_place_subs_one: List[Dict[str, Any]] = canvas_subs_dict['DADA_Placement_1'] | ||
self.canvas_dada_place_subs_two: List[Dict[str, Any]] = canvas_subs_dict['DADA_Placement_2'] | ||
self.canvas_potions_place_subs_three: List[Dict[str, Any]] = canvas_subs_dict['Potions_Placement_3'] | ||
|
||
with open(os.path.join(API_FIXTURES_DIR, 'mpathways_resp_data.json'), 'r') as mpathways_resp_data_file: | ||
self.mpathways_resp_data: List[Dict[str, Any]] = json.loads(mpathways_resp_data_file.read()) | ||
|
@@ -217,6 +218,16 @@ def test_create_sub_records_with_null_submitted_timestamp_and_attempt_num(self): | |
} | ||
) | ||
|
||
def test_create_sub_records_strips_whitespace_in_login_id(self): | ||
"""create_sub_records strips leading and trailing whitespace characters from Canvas login_ids.""" | ||
potions_place_exam: Exam = Exam.objects.get(id=1) | ||
some_orca: ScoresOrchestration = ScoresOrchestration(self.api_handler, potions_place_exam) | ||
some_orca.create_sub_records(self.canvas_potions_place_subs_three) | ||
|
||
latest_two_subs: List[Submission] = list(Submission.objects.filter(exam=potions_place_exam).order_by('-id'))[:2] | ||
uniqnames: List[str] = [sub.student_uniqname for sub in latest_two_subs] | ||
self.assertEqual(uniqnames, ['[email protected]', '[email protected]']) | ||
|
||
def test_send_scores_when_successful(self): | ||
""" | ||
send_scores properly transmits data to M-Pathways API and updates all submission records. | ||
|