def test_missing_post_parameter(self, param): del self.request.GET[param] response = lti_consumer.launch_lti_preview(self.request) self.assertEqual( response.status_code, 400, 'Expected Bad Request status when parameter {} missing'.format(param) )
def test_main_with_missing_course(self): with patch('edx2canvas.models.EdxCourse.objects.get') as get_mock: get_mock.side_effect = models.EdxCourse.DoesNotExist() response = lti_consumer.launch_lti_preview(self.request) self.assertEqual( response.status_code, 404, 'Expected Not Found status code when edX course does not exist' )