def test_lti_rest_non_get(self): """tests that the endpoint returns 404 when hit with NON-get""" DISALLOWED_METHODS = ("POST", "PUT", "DELETE", "HEAD", "OPTIONS") # pylint: disable=invalid-name for method in DISALLOWED_METHODS: request = mock.Mock() request.method = method response = get_course_lti_endpoints(request, self.course.id.to_deprecated_string()) self.assertEqual(405, response.status_code)
def test_lti_rest_listing(self): """tests that the draft lti module is part of the endpoint response""" request = mock.Mock() request.method = 'GET' response = get_course_lti_endpoints(request, course_id=self.course.id.to_deprecated_string()) self.assertEqual(200, response.status_code) self.assertEqual('application/json', response['Content-Type']) expected = { "lti_1_1_result_service_xml_endpoint": self.expected_handler_url('grade_handler'), "lti_2_0_result_service_json_endpoint": self.expected_handler_url('lti_2_0_result_rest_handler') + "/user/{anon_user_id}", "display_name": self.lti_published.display_name, } self.assertEqual([expected], json.loads(response.content))