@@ -57,10 +57,12 @@ def test_correct_response_data_on_success(self, response_mock, basic_call):
5757 assert basic_call == self .response_format
5858
5959 def test_called_with_correct_athorization (self , response_mock , basic_call ):
60- assert response_mock .call_args .kwargs ["headers" ]["Authorization" ] == f"MarkUsAuth { FAKE_API_KEY } "
60+ _ , kwargs = response_mock .call_args
61+ assert kwargs ["headers" ]["Authorization" ] == f"MarkUsAuth { FAKE_API_KEY } "
6162
6263 def test_called_with_correct_url (self , response_mock , basic_call ):
63- assert response_mock .call_args .args [0 ] == f"{ FAKE_URL } /api/{ self .url } .json"
64+ args , _ = response_mock .call_args
65+ assert args [0 ] == f"{ FAKE_URL } /api/{ self .url } .json"
6466
6567
6668class TestGetAllUsers (AbstractTestClass ):
@@ -87,7 +89,8 @@ def basic_call(api):
8789 def test_called_with_basic_params (self , api , response_mock ):
8890 api .new_user ("test" , "Student" , "first" , "last" )
8991 params = {"user_name" : "test" , "type" : "Student" , "first_name" : "first" , "last_name" : "last" }
90- assert response_mock .call_args .kwargs ["params" ] == params
92+ _ , kwargs = response_mock .call_args
93+ assert kwargs ["params" ] == params
9194
9295 def test_called_with_section (self , api , response_mock ):
9396 api .new_user ("test" , "Student" , "first" , "last" , section_name = "section" )
@@ -98,7 +101,8 @@ def test_called_with_section(self, api, response_mock):
98101 "last_name" : "last" ,
99102 "section_name" : "section" ,
100103 }
101- assert response_mock .call_args .kwargs ["params" ] == params
104+ _ , kwargs = response_mock .call_args
105+ assert kwargs ["params" ] == params
102106
103107 def test_called_with_grace_credits (self , api , response_mock ):
104108 api .new_user ("test" , "Student" , "first" , "last" , grace_credits = "3" )
@@ -109,7 +113,8 @@ def test_called_with_grace_credits(self, api, response_mock):
109113 "last_name" : "last" ,
110114 "grace_credits" : "3" ,
111115 }
112- assert response_mock .call_args .kwargs ["params" ] == params
116+ _ , kwargs = response_mock .call_args
117+ assert kwargs ["params" ] == params
113118
114119
115120class TestGetAssignments (AbstractTestClass ):
@@ -210,7 +215,8 @@ def test_called_with_basic_params(self, api, response_mock):
210215 "show_total" : True ,
211216 "grade_entry_items" : None ,
212217 }
213- assert response_mock .call_args .kwargs ["params" ] == params
218+ _ , kwargs = response_mock .call_args
219+ assert kwargs ["params" ] == params
214220
215221 def test_called_with_is_hidden (self , api , response_mock ):
216222 now = datetime .datetime .now ()
@@ -223,7 +229,8 @@ def test_called_with_is_hidden(self, api, response_mock):
223229 "show_total" : True ,
224230 "grade_entry_items" : None ,
225231 }
226- assert response_mock .call_args .kwargs ["params" ] == params
232+ _ , kwargs = response_mock .call_args
233+ assert kwargs ["params" ] == params
227234
228235 def test_called_with_is_show_total (self , api , response_mock ):
229236 now = datetime .datetime .now ()
@@ -236,7 +243,8 @@ def test_called_with_is_show_total(self, api, response_mock):
236243 "show_total" : False ,
237244 "grade_entry_items" : None ,
238245 }
239- assert response_mock .call_args .kwargs ["params" ] == params
246+ _ , kwargs = response_mock .call_args
247+ assert kwargs ["params" ] == params
240248
241249 def test_called_with_is_show_grade_entry_items (self , api , response_mock ):
242250 now = datetime .datetime .now ()
@@ -250,7 +258,8 @@ def test_called_with_is_show_grade_entry_items(self, api, response_mock):
250258 "show_total" : True ,
251259 "grade_entry_items" : ge_items ,
252260 }
253- assert response_mock .call_args .kwargs ["params" ] == params
261+ _ , kwargs = response_mock .call_args
262+ assert kwargs ["params" ] == params
254263
255264
256265class TestUpdateMarksSpreadsheet (AbstractTestClass ):
@@ -267,19 +276,22 @@ def test_called_with_basic_params(self, api, response_mock):
267276 now = datetime .datetime .now ()
268277 api .update_marks_spreadsheet (1 , "test" , "description" , now )
269278 params = {"short_identifier" : "test" , "description" : "description" , "date" : now }
270- assert response_mock .call_args .kwargs ["params" ] == params
279+ _ , kwargs = response_mock .call_args
280+ assert kwargs ["params" ] == params
271281
272282 def test_called_with_is_hidden (self , api , response_mock ):
273283 now = datetime .datetime .now ()
274284 api .update_marks_spreadsheet (1 , "test" , "description" , now , is_hidden = False )
275285 params = {"short_identifier" : "test" , "description" : "description" , "date" : now , "is_hidden" : False }
276- assert response_mock .call_args .kwargs ["params" ] == params
286+ _ , kwargs = response_mock .call_args
287+ assert kwargs ["params" ] == params
277288
278289 def test_called_with_is_show_total (self , api , response_mock ):
279290 now = datetime .datetime .now ()
280291 api .update_marks_spreadsheet (1 , "test" , "description" , now , show_total = False )
281292 params = {"short_identifier" : "test" , "description" : "description" , "date" : now , "show_total" : False }
282- assert response_mock .call_args .kwargs ["params" ] == params
293+ _ , kwargs = response_mock .call_args
294+ assert kwargs ["params" ] == params
283295
284296 def test_called_with_is_show_grade_entry_items (self , api , response_mock ):
285297 now = datetime .datetime .now ()
@@ -291,7 +303,8 @@ def test_called_with_is_show_grade_entry_items(self, api, response_mock):
291303 "date" : now ,
292304 "grade_entry_items" : ge_items ,
293305 }
294- assert response_mock .call_args .kwargs ["params" ] == params
306+ _ , kwargs = response_mock .call_args
307+ assert kwargs ["params" ] == params
295308
296309
297310class TestUpdateMarksSpreadsheetGrades (AbstractTestClass ):
@@ -307,7 +320,8 @@ def basic_call(api):
307320 def test_called_with_basic_params (self , api , response_mock ):
308321 api .update_marks_spreadsheets_grades (1 , "some_user" , {"some_column" : 2 })
309322 params = {"user_name" : "some_user" , "grade_entry_items" : {"some_column" : 2 }}
310- assert response_mock .call_args .kwargs ["json" ] == params
323+ _ , kwargs = response_mock .call_args
324+ assert kwargs ["json" ] == params
311325
312326
313327class TestGetMarksSpreadsheets (AbstractTestClass ):
@@ -346,19 +360,22 @@ def basic_call(api):
346360 def test_discovers_mime_type (self , api , response_mock ):
347361 api .get_feedback_files = Mock (return_value = [{"id" : 1 , "filename" : "test.txt" }])
348362 api .upload_feedback_file (1 , 1 , "test.txt" , "feedback info" )
349- assert response_mock .call_args .kwargs ["params" ]["mime_type" ] == "text/plain"
363+ _ , kwargs = response_mock .call_args
364+ assert kwargs ["params" ]["mime_type" ] == "text/plain"
350365
351366 def test_called_with_mime_type (self , api , response_mock ):
352367 api .get_feedback_files = Mock (return_value = [{"id" : 1 , "filename" : "test.txt" }])
353368 api .upload_feedback_file (1 , 1 , "test.txt" , "feedback info" , mime_type = "application/octet-stream" )
354369 params = {"filename" : "test.txt" , "mime_type" : "application/octet-stream" }
355- assert response_mock .call_args .kwargs ["params" ] == params
370+ _ , kwargs = response_mock .call_args
371+ assert kwargs ["params" ] == params
356372
357373 def test_sends_file_data (self , api , response_mock ):
358374 api .get_feedback_files = Mock (return_value = [{"id" : 1 , "filename" : "test.txt" }])
359375 api .upload_feedback_file (1 , 1 , "test.txt" , "feedback info" )
360376 files = {"file_content" : ("test.txt" , "feedback info" )}
361- assert response_mock .call_args .kwargs ["files" ] == files
377+ _ , kwargs = response_mock .call_args
378+ assert kwargs ["files" ] == files
362379
363380
364381class TestUploadFeedbackFileNew (AbstractTestClass ):
@@ -394,7 +411,8 @@ def basic_call(api):
394411 def test_called_wth_basic_args (self , api , response_mock ):
395412 api .upload_test_group_results (1 , 1 , 1 , '{"data": []}' )
396413 params = {"test_run_id" : 1 , "test_output" : '{"data": []}' }
397- assert response_mock .call_args .kwargs ["json" ] == params
414+ _ , kwargs = response_mock .call_args
415+ assert kwargs ["json" ] == params
398416
399417
400418class TestUploadTestGroupResultsDict (AbstractTestClass ):
@@ -409,7 +427,8 @@ def basic_call(api):
409427
410428 def test_dict_changed_to_json_string (self , api , response_mock ):
411429 api .upload_test_group_results (1 , 1 , 1 , {"data" : []})
412- assert response_mock .call_args .kwargs ["json" ]["test_output" ] == '{"data": []}'
430+ _ , kwargs = response_mock .call_args
431+ assert kwargs ["json" ]["test_output" ] == '{"data": []}'
413432
414433
415434class TestUploadAnnotations (AbstractTestClass ):
@@ -436,12 +455,14 @@ def basic_call(cls, api):
436455 def test_called_with_basic_params (self , api , response_mock ):
437456 api .upload_annotations (1 , 1 , self .annotations )
438457 params = {"annotations" : self .annotations , "force_complete" : False }
439- assert response_mock .call_args .kwargs ["json" ] == params
458+ _ , kwargs = response_mock .call_args
459+ assert kwargs ["json" ] == params
440460
441461 def test_called_with_force_complete (self , api , response_mock ):
442462 api .upload_annotations (1 , 1 , self .annotations , True )
443463 params = {"annotations" : self .annotations , "force_complete" : True }
444- assert response_mock .call_args .kwargs ["json" ] == params
464+ _ , kwargs = response_mock .call_args
465+ assert kwargs ["json" ] == params
445466
446467
447468class TestGetAnnotations (AbstractTestClass ):
@@ -467,7 +488,8 @@ def basic_call(api):
467488
468489 def test_called_with_basic_params (self , api , response_mock ):
469490 api .update_marks_single_group ({"criteria_a" : 10 }, 1 , 1 )
470- assert response_mock .call_args .kwargs ["json" ] == {"criteria_a" : 10 }
491+ _ , kwargs = response_mock .call_args
492+ assert kwargs ["json" ] == {"criteria_a" : 10 }
471493
472494
473495class TestUpdateMarkingState (AbstractTestClass ):
@@ -482,7 +504,8 @@ def basic_call(api):
482504
483505 def test_called_with_basic_params (self , api , response_mock ):
484506 api .update_marking_state (1 , 1 , "collected" )
485- assert response_mock .call_args .kwargs ["params" ] == {"marking_state" : "collected" }
507+ _ , kwargs = response_mock .call_args
508+ assert kwargs ["params" ] == {"marking_state" : "collected" }
486509
487510
488511class TestCreateExtraMarks (AbstractTestClass ):
@@ -497,7 +520,8 @@ def basic_call(api):
497520
498521 def test_called_with_basic_params (self , api , response_mock ):
499522 api .create_extra_marks (1 , 1 , 10 , "a bonus!" )
500- assert response_mock .call_args .kwargs ["params" ] == {"extra_marks" : 10 , "description" : "a bonus!" }
523+ _ , kwargs = response_mock .call_args
524+ assert kwargs ["params" ] == {"extra_marks" : 10 , "description" : "a bonus!" }
501525
502526
503527class TestRemoveExtraMarks (AbstractTestClass ):
@@ -512,7 +536,8 @@ def basic_call(api):
512536
513537 def test_called_with_basic_params (self , api , response_mock ):
514538 api .remove_extra_marks (1 , 1 , 10 , "a bonus!" )
515- assert response_mock .call_args .kwargs ["params" ] == {"extra_marks" : 10 , "description" : "a bonus!" }
539+ _ , kwargs = response_mock .call_args
540+ assert kwargs ["params" ] == {"extra_marks" : 10 , "description" : "a bonus!" }
516541
517542
518543class TestGetFilesFromRepo (AbstractTestClass ):
@@ -527,15 +552,18 @@ def basic_call(api):
527552
528553 def test_called_with_basic_params (self , api , response_mock ):
529554 api .get_files_from_repo (1 , 1 )
530- assert response_mock .call_args .kwargs ["params" ] == {"collected" : True }
555+ _ , kwargs = response_mock .call_args
556+ assert kwargs ["params" ] == {"collected" : True }
531557
532558 def test_called_with_collected (self , api , response_mock ):
533559 api .get_files_from_repo (1 , 1 , collected = False )
534- assert response_mock .call_args .kwargs ["params" ] == {}
560+ _ , kwargs = response_mock .call_args
561+ assert kwargs ["params" ] == {}
535562
536563 def test_called_with_filename (self , api , response_mock ):
537564 api .get_files_from_repo (1 , 1 , filename = "test.txt" )
538- assert response_mock .call_args .kwargs ["params" ] == {"collected" : True , "filename" : "test.txt" }
565+ _ , kwargs = response_mock .call_args
566+ assert kwargs ["params" ] == {"collected" : True , "filename" : "test.txt" }
539567
540568
541569class TestUploadFolderToRepo (AbstractTestClass ):
@@ -550,7 +578,8 @@ def basic_call(api):
550578
551579 def test_called_with_basic_params (self , api , response_mock ):
552580 api .upload_folder_to_repo (1 , 1 , "subdir" )
553- assert response_mock .call_args .kwargs ["params" ] == {"folder_path" : "subdir" }
581+ _ , kwargs = response_mock .call_args
582+ assert kwargs ["params" ] == {"folder_path" : "subdir" }
554583
555584
556585class TestUploadFileToRepo (AbstractTestClass ):
@@ -565,17 +594,20 @@ def basic_call(api):
565594
566595 def test_discovers_mime_type (self , api , response_mock ):
567596 api .upload_file_to_repo (1 , 1 , "test.txt" , "some content" )
568- assert response_mock .call_args .kwargs ["params" ]["mime_type" ] == "text/plain"
597+ _ , kwargs = response_mock .call_args
598+ assert kwargs ["params" ]["mime_type" ] == "text/plain"
569599
570600 def test_called_with_mime_type (self , api , response_mock ):
571601 api .upload_file_to_repo (1 , 1 , "test.txt" , "feedback info" , mime_type = "application/octet-stream" )
572602 params = {"filename" : "test.txt" , "mime_type" : "application/octet-stream" }
573- assert response_mock .call_args .kwargs ["params" ] == params
603+ _ , kwargs = response_mock .call_args
604+ assert kwargs ["params" ] == params
574605
575606 def test_sends_file_data (self , api , response_mock ):
576607 api .upload_file_to_repo (1 , 1 , "test.txt" , "some content" )
577608 files = {"file_content" : ("test.txt" , "some content" )}
578- assert response_mock .call_args .kwargs ["files" ] == files
609+ _ , kwargs = response_mock .call_args
610+ assert kwargs ["files" ] == files
579611
580612
581613class TestRemoveFileFromRepo (AbstractTestClass ):
@@ -590,7 +622,8 @@ def basic_call(api):
590622
591623 def test_called_with_basic_params (self , api , response_mock ):
592624 api .remove_file_from_repo (1 , 1 , "test.txt" )
593- assert response_mock .call_args .kwargs ["params" ] == {"filename" : "test.txt" }
625+ _ , kwargs = response_mock .call_args
626+ assert kwargs ["params" ] == {"filename" : "test.txt" }
594627
595628
596629class TestRemoveFolderFromRepo (AbstractTestClass ):
@@ -605,7 +638,8 @@ def basic_call(api):
605638
606639 def test_called_with_basic_params (self , api , response_mock ):
607640 api .remove_folder_from_repo (1 , 1 , "subdir" )
608- assert response_mock .call_args .kwargs ["params" ] == {"folder_path" : "subdir" }
641+ _ , kwargs = response_mock .call_args
642+ assert kwargs ["params" ] == {"folder_path" : "subdir" }
609643
610644
611645class TestGetTestSpecs (AbstractTestClass ):
@@ -632,7 +666,8 @@ def basic_call(api):
632666 def test_called_with_basic_params (self , api , response_mock ):
633667 specs = {"some" : ["fake" , "data" ]}
634668 api .update_test_specs (1 , specs )
635- assert response_mock .call_args .kwargs ["json" ] == {"specs" : specs }
669+ _ , kwargs = response_mock .call_args
670+ assert kwargs ["json" ] == {"specs" : specs }
636671
637672
638673class TestGetTestFiles (AbstractTestClass ):
0 commit comments