Private
Public Access
1
0

proj: Fix warnings

This commit is contained in:
2025-01-20 22:13:44 -08:00
parent 5d3d2f194a
commit bfc6fdddc1
5 changed files with 15 additions and 7 deletions

View File

@@ -1,8 +1,7 @@
extern crate hyper;
extern crate serde;
use std::{ffi::OsString, path::PathBuf, str};
use log::{error};
use std::{path::PathBuf, str};
use hyper::{Body, Client, Method, Request, Uri};
@@ -76,10 +75,13 @@ impl AuthBuilder for hyper::http::request::Builder {
}
}
#[cfg(test)]
#[allow(dead_code)]
trait AuthSetting {
fn authenticate(&mut self, token: &Option<JwtToken>);
}
#[cfg(test)]
impl<B> AuthSetting for hyper::http::Request<B> {
fn authenticate(&mut self, token: &Option<JwtToken>) {
if let Some(token) = &token {
@@ -221,9 +223,11 @@ impl HTTPAPIClient {
}
}
#[cfg(test)]
mod test {
use super::*;
#[cfg(test)]
fn local_mock_client() -> HTTPAPIClient {
let base_url = "http://localhost:5738".parse().unwrap();
let credentials = Credentials {
@@ -234,6 +238,7 @@ mod test {
HTTPAPIClient::new(base_url, credentials.into())
}
#[cfg(test)]
async fn mock_client_is_reachable() -> bool {
let mut client = local_mock_client();
let version = client.get_version().await;
@@ -241,7 +246,7 @@ mod test {
match version {
Ok(_) => true,
Err(e) => {
error!("Mock client error: {:?}", e);
log::error!("Mock client error: {:?}", e);
false
}
}

View File

@@ -10,18 +10,21 @@ use hyper::http::HeaderValue;
use serde::Deserialize;
#[derive(Deserialize, Debug, Clone)]
#[allow(dead_code)]
struct JwtHeader {
alg: String,
typ: String,
}
#[derive(Deserialize, Debug, Clone)]
#[allow(dead_code)]
enum ExpValue {
Integer(i64),
String(String),
}
#[derive(Deserialize, Debug, Clone)]
#[allow(dead_code)]
struct JwtPayload {
exp: serde_json::Value,
iss: Option<String>,
@@ -29,6 +32,7 @@ struct JwtPayload {
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct JwtToken {
header: JwtHeader,
payload: JwtPayload,

View File

@@ -4,7 +4,7 @@ use std::collections::HashMap;
pub use crate::APIInterface;
use crate::{
api::http_client::Credentials,
model::{conversation, Conversation, ConversationID, JwtToken, Message}
model::{Conversation, ConversationID, JwtToken, Message}
};
pub struct TestClient {