'Tests that the accessible discussion xblocks having no parents do not get fetched for split modulestore.'

@ddt.data((ModuleStoreEnum.Type.mongo, 2), (ModuleStoreEnum.Type.split, 1))
@ddt.unpack
def test_get_accessible_discussion_xblocks(self, modulestore_type, expected_discussion_xblocks):

    course = CourseFactory.create(default_store=modulestore_type)
    test_discussion = self.store.create_child(self.user.id, course.location, 'discussion', 'test_discussion')
    self.assertNotIn(test_discussion.location, self.store.get_orphans(course.id))
    self.assertEqual(len(utils.get_accessible_discussion_xblocks(course, self.user)), 1)
    orphan = course.id.make_usage_key('discussion', 'orphan_discussion')
    self.store.create_item(self.user.id, orphan.course_key, orphan.block_type, block_id=orphan.block_id)
    self.assertIn(orphan, self.store.get_orphans(course.id))
    self.assertEqual(len(utils.get_accessible_discussion_xblocks(course, self.user)), expected_discussion_xblocks)
