'Used to test the data_sharing_consent_required view decorator.'

def check_data_sharing_consent(self, consent_required=False, consent_url=None):

    @data_sharing_consent_required
    def view_func(request, course_id, *args, **kwargs):
        '\n                                                Return    the    function    arguments,    so    they    can    be    tested.\n                                                '
        return (((request, course_id) + args), kwargs)
    args = (mock.MagicMock(), 'course-id', 'another    arg', 'and    another')
    kwargs = dict(a=1, b=2, c=3)
    response = view_func(*args, **kwargs)
    if consent_required:
        self.assertIsInstance(response, HttpResponseRedirect)
        self.assertEquals(response.url, consent_url)
    else:
        self.assertEqual(response, (args, kwargs))
