@@ -697,9 +697,13 @@ def test_access_token_endpoint(self):
697697 self .mock_client .access_token .return_value = token
698698
699699 body = self .get_body (create_jwt (self .key , {}))
700- response = self .client .post (self .url , data = body )
700+ response = self .client .post (self .url , data = json .dumps (body ), content_type = 'application/json' )
701+ self .mock_client .access_token .assert_called_once ()
702+ called_args = self .mock_client .access_token .call_args [0 ]
703+ actual_arg = called_args [0 ]
704+ actual_dict = json .loads (next (iter (actual_arg .keys ())))
701705
702- self .mock_client . access_token . called_once_with ( body )
706+ self .assertEqual ( actual_dict , body )
703707 self .assertEqual (response .status_code , 200 )
704708 self .assertEqual (response .json (), token )
705709
@@ -715,9 +719,14 @@ def test_access_token_endpoint_with_location_in_url(self):
715719 args = [str (self .config .location )]
716720 )
717721 body = self .get_body (create_jwt (self .key , {}))
718- response = self .client .post (url , data = body )
722+ response = self .client .post (url , data = json . dumps ( body ), content_type = 'application/json' )
719723
720- self .mock_client .access_token .called_once_with (body )
724+ self .mock_client .access_token .assert_called_once ()
725+ called_args = self .mock_client .access_token .call_args [0 ]
726+ actual_arg = called_args [0 ]
727+ actual_dict = json .loads (next (iter (actual_arg .keys ())))
728+
729+ self .assertEqual (actual_dict , body )
721730 self .assertEqual (response .status_code , 200 )
722731 self .assertEqual (response .json (), token )
723732
@@ -748,7 +757,8 @@ def test_access_token_endpoint_with_external_id_in_url(
748757 body = self .get_body (create_jwt (self .key , {}))
749758 response = self .client .post (
750759 reverse ('lti_consumer:lti_consumer.access_token_via_external_id' , args = ['x' , 'x' ]),
751- data = body ,
760+ data = json .dumps (body ),
761+ content_type = 'application/json'
752762 )
753763
754764 get_external_config_from_filter .assert_called_once_with ({}, 'x:x' )
@@ -765,7 +775,12 @@ def test_access_token_endpoint_with_external_id_in_url(
765775 tool_key = external_config ['lti_1p3_tool_public_key' ],
766776 tool_keyset_url = external_config ['lti_1p3_tool_keyset_url' ],
767777 )
768- lti_consumer ().access_token .called_once_with (body )
778+ lti_consumer ().access_token .assert_called_once ()
779+ called_args = lti_consumer ().access_token .call_args [0 ]
780+ actual_arg = called_args [0 ]
781+ actual_dict = json .loads (next (iter (actual_arg .keys ())))
782+
783+ self .assertEqual (actual_dict , body )
769784 self .assertEqual (response .status_code , 200 )
770785 self .assertEqual (response .json (), token )
771786
0 commit comments