'Set up the xblock runtime, test course, discussion, and user.'

def setUp(self):

    super(TestDiscussionXBlock, self).setUp()
    self.patchers = []
    self.course_id = 'test_course'
    self.runtime = self.new_module_runtime()
    self.runtime.modulestore = mock.Mock()
    self.discussion_id = str(uuid.uuid4())
    self.data = DictFieldData({'discussion_id': self.discussion_id})
    scope_ids = mock.Mock()
    scope_ids.usage_id.course_key = self.course_id
    self.block = DiscussionXBlock(self.runtime, field_data=self.data, scope_ids=scope_ids)
    self.block.xmodule_runtime = mock.Mock()
    if self.PATCH_DJANGO_USER:
        self.django_user_canary = object()
        self.django_user_mock = self.add_patcher(mock.patch.object(DiscussionXBlock, 'django_user', new_callable=mock.PropertyMock))
        self.django_user_mock.return_value = self.django_user_canary
