Retry auth automatically, remove tower dep
This commit is contained in:
@@ -9,7 +9,7 @@ pub mod api_interface {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_version() {
|
||||
let client = TestClient::new();
|
||||
let mut client = TestClient::new();
|
||||
let version = client.get_version().await.unwrap();
|
||||
assert_eq!(version, client.version);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use async_trait::async_trait;
|
||||
|
||||
pub use crate::APIInterface;
|
||||
use crate::model::Conversation;
|
||||
use crate::{api::http_client::Credentials, model::{Conversation, JwtToken}};
|
||||
|
||||
pub struct TestClient {
|
||||
pub version: &'static str,
|
||||
@@ -24,11 +24,15 @@ impl TestClient {
|
||||
impl APIInterface for TestClient {
|
||||
type Error = TestError;
|
||||
|
||||
async fn get_version(&self) -> Result<String, Self::Error> {
|
||||
async fn authenticate(&mut self, credentials: Credentials) -> Result<JwtToken, Self::Error> {
|
||||
Ok(JwtToken::dummy())
|
||||
}
|
||||
|
||||
async fn get_version(&mut self) -> Result<String, Self::Error> {
|
||||
Ok(self.version.to_string())
|
||||
}
|
||||
|
||||
async fn get_conversations(&self) -> Result<Vec<Conversation>, Self::Error> {
|
||||
async fn get_conversations(&mut self) -> Result<Vec<Conversation>, Self::Error> {
|
||||
Ok(self.conversations.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user