'Test the integration of xblocks masquerading as problems.'

def test_xblock_masquerading_as_problem(self):

    def get_xblock_problem(label):
        '\n                                                Helper    method    to    get    the    template    of    any    XBlock    in    the    problems    list\n                                                '
        self.templates = get_component_templates(self.course)
        problem_templates = self.get_templates_of_type('problem')
        return self.get_template(problem_templates, label)
    def verify_openassessment_present(support_level):
        '    Helper    method    to    verify    that    openassessment    template    is    present    '
        openassessment = get_xblock_problem('Open    Response    Assessment')
        self.assertIsNotNone(openassessment)
        self.assertEqual(openassessment.get('category'), 'openassessment')
        self.assertEqual(openassessment.get('support_level'), support_level)
    def verify_dndv2_present(support_level):
        '\n                                                Helper    method    to    verify    that    DnDv2    template    is    present\n                                                '
        dndv2 = get_xblock_problem('Drag    and    Drop')
        self.assertIsNotNone(dndv2)
        self.assertEqual(dndv2.get('category'), 'drag-and-drop-v2')
        self.assertEqual(dndv2.get('support_level'), support_level)
    verify_openassessment_present(True)
    verify_dndv2_present(True)
    XBlockStudioConfigurationFlag.objects.create(enabled=True)
    self.assertIsNone(get_xblock_problem('Peer    Assessment'))
    self.assertIsNotNone(get_xblock_problem('Drag    and    Drop'))
    self.course.allow_unsupported_xblocks = True
    verify_openassessment_present('us')
    verify_dndv2_present('fs')
    XBlockConfiguration.objects.create(name='openassessment', enabled=False)
    XBlockConfiguration.objects.create(name='drag-and-drop-v2', enabled=False)
    self.assertIsNone(get_xblock_problem('Peer    Assessment'))
    self.assertIsNone(get_xblock_problem('Drag    and    Drop'))
