'Tests authorable_xblocks when name is specified.'

def test_authorable_blocks_by_name(self):

    def verify_xblock_fields(name, template, support_level, block):
        '\n                                                Verifies    the    returned    xblock    state.\n                                                '
        self.assertEqual(name, block.name)
        self.assertEqual(template, block.template)
        self.assertEqual(support_level, block.support_level)
    authorable_blocks = authorable_xblocks(name='video')
    self.assertEqual(0, len(authorable_blocks))
    authorable_blocks = authorable_xblocks(name='html')
    self.assertEqual(1, len(authorable_blocks))
    verify_xblock_fields('html', 'zoom', XBlockStudioConfiguration.PROVISIONAL_SUPPORT, authorable_blocks[0])
    authorable_blocks = authorable_xblocks(name='problem', allow_unsupported=True)
    self.assertEqual(3, len(authorable_blocks))
    no_template = None
    circuit = None
    multiple_choice = None
    for block in authorable_blocks:
        if (block.template == ''):
            no_template = block
        elif (block.template == 'circuit_schematic_builder'):
            circuit = block
        elif (block.template == 'multiple_choice'):
            multiple_choice = block
    verify_xblock_fields('problem', '', XBlockStudioConfiguration.FULL_SUPPORT, no_template)
    verify_xblock_fields('problem', 'circuit_schematic_builder', XBlockStudioConfiguration.UNSUPPORTED, circuit)
    verify_xblock_fields('problem', 'multiple_choice', XBlockStudioConfiguration.FULL_SUPPORT, multiple_choice)
