You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: http_query_handlers.rs
    path of file: ./repos/databend/src/query/service/tests/it/servers/http
    
    the code of the file until where you have to start completion: // Copyright 2021 Datafuse Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::BTreeMap;
use std::fs::File;
use std::io::Read;
use std::time::Duration;

use base64::engine::general_purpose;
use base64::prelude::*;
use databend_common_base::base::get_free_tcp_port;
use databend_common_base::base::tokio;
use databend_common_exception::ErrorCode;
use databend_common_exception::Result;
use databend_common_meta_app::principal::AuthInfo;
use dat
    
async fn test_auth_jwt() -> Result<()> {
    let user_name = "test_user";

    let kid = "test_kid";
    let key_pair = RS256KeyPair::generate(2048)?.with_key_id(kid);
    let rsa_components = key_pair.public_key().to_components();
    let e = general_purpose::URL_SAFE_NO_PAD.encode(rsa_components.e);
    let n = general_purpose::URL_SAFE_NO_PAD.encode(rsa_components.n);
    let j =
        serde_json::json!({"keys": [ {"kty": "RSA", "kid": kid, "e": e, "n": n, } ] }).to_string();

    let server = MockServer::start().await;
    let json_path = "/jwks.json";
    // Create a mock on the server.
    let template = ResponseTemplate::new(200).set_body_raw(j, "application/json");
    Mock::given(method("GET"))
        .and(path(json_path))
        .respond_with(template)
        .expect(1..)
        // Mounting the mock on the mock server - it's now effective!
        .mount(&server)
        .await;

    // Setup mock jwks url
    let config = ConfigBuilder::create()
        .jwt_key_file(format!("http://{}{}", server.address(), json_path))
        .build();
    let _fixture = TestFixture::setup_with_config(&config).await?;

    let session_middleware =
        HTTPSessionMiddleware::create(HttpHandlerKind::Query, AuthMgr::instance());

    let ep = Route::new()
        .nest("/v1/query", query_route())
        .with(session_middleware);

    let now = Clock::now_since_epoch();
    let claims = JWTClaims {
        issued_at: Some(now),
        expires_at: Some(now + jwt_simple::prelude::Duration::from_secs(10)),
        invalid_before: Some(now),
        audiences: None,
        issuer: None,
        jwt_id: None,
        subject: Some(user_name.to_string()),
        nonce: None,
        custom: NoCustomClaims {},
    };

    let token = key_pair.sign(claims)?;
    let bear = headers::Authorization::bearer(&token).unwrap();
    assert_auth_failure(&ep, bear).await?;

    Ok(())
}