def METHOD_NAME():
    """
    Test that the ctftime function redirects users to the team creation page in teams mode before the ctf if the user
    has no team yet.
    """
    app = create_ctfd(user_mode=TEAMS_MODE)
    with app.app_context():
        with ctftime.init():
            register_user(app)
            chal = gen_challenge(app.db)
            gen_flag(app.db, challenge_id=chal.id, content="flag")
            with ctftime.not_started():
                client = login_as_user(app)
                r = client.get("/challenges")
                assert r.status_code == 302
            gen_team(app.db, name="test", password="password")
            with login_as_user(app) as client:
                r = client.get("/teams/join")
                assert r.status_code == 200
                with client.session_transaction() as sess:
                    data = {
                        "name": "test",
                        "password": "password",
                        "nonce": sess.get("nonce"),
                    }
                r = client.post("/teams/join", data=data)
                assert r.status_code == 302
            with ctftime.not_started():
                client = login_as_user(app)
                r = client.get("/challenges")
                assert r.status_code == 403
    destroy_ctfd(app)