예제 #1
0
def test_register_user_page_menu_bar():
    """
    Test that the register_user_page_menu_bar() properly inserts into HTML and get_user_page_menu_bar() returns the
    proper list.
    """
    app = create_ctfd()
    with app.app_context():
        register_user_page_menu_bar(title='test_user_menu_link', route='/test_user_href')

        with app.test_client() as client:
            r = client.get('/')

        output = r.get_data(as_text=True)
        assert '/test_user_href' in output
        assert 'test_user_menu_link' in output

        menu_item = get_user_page_menu_bar()[0]
        assert menu_item.title == 'test_user_menu_link'
        assert menu_item.route == '/test_user_href'
    destroy_ctfd(app)
예제 #2
0
def test_register_user_page_menu_bar():
    """
    Test that the register_user_page_menu_bar() properly inserts into HTML and get_user_page_menu_bar() returns the
    proper list.
    """
    app = create_ctfd()
    with app.app_context():
        register_user_page_menu_bar(title="test_user_menu_link",
                                    route="/test_user_href")

        with app.test_client() as client:
            r = client.get("/")
            output = r.get_data(as_text=True)
            assert "/test_user_href" in output
            assert "test_user_menu_link" in output

        with app.test_request_context():
            menu_item = get_user_page_menu_bar()[0]
            assert menu_item.title == "test_user_menu_link"
            assert menu_item.route == "/test_user_href"
    destroy_ctfd(app)
예제 #3
0
파일: plugins.py 프로젝트: KaitoRyouga/CTFd
 def user_menu_pages(self):
     return get_user_page_menu_bar()