

def test_submenu():
    app = Flask(__name__)
    admin = base.Admin(app)
    admin.add_view(MockView(name='Test 1', category='Test', endpoint='test1'))
    view = MockView(name='Test 2', category='Test', endpoint='test2')
    view.allow_access = False
    admin.add_view(view)
    ok_(('Test' in admin._menu_categories))
    eq_(len(admin._menu), 2)
    eq_(admin._menu[1].name, 'Test')
    eq_(len(admin._menu[1]._children), 2)
    eq_(admin._menu[1].get_url(), None)
    eq_(admin._menu[1].is_accessible(), True)
    children = admin._menu[1].get_children()
    eq_(len(children), 1)
    ok_(children[0].is_accessible())

dataset/ETHPy150Open mrjoes/flask-admin/flask_admin/tests/test_base.py test_submenu/original