Fix tests
This commit is contained in:
@@ -1,16 +1,34 @@
|
||||
use async_trait::async_trait;
|
||||
|
||||
pub use crate::APIInterface;
|
||||
use crate::model::Conversation;
|
||||
|
||||
pub struct TestClient {}
|
||||
pub struct TestClient {
|
||||
pub version: &'static str,
|
||||
pub conversations: Vec<Conversation>,
|
||||
}
|
||||
|
||||
impl APIInterface for TestClient {
|
||||
fn get_version(&self) -> String {
|
||||
return "KordophoneTest-1.0".to_string()
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum TestError {}
|
||||
|
||||
fn get_conversations(&self) -> Vec<Conversation> {
|
||||
let mut conversations = Vec::new();
|
||||
conversations.push(Conversation::builder().display_name("Test Conversation").build());
|
||||
conversations
|
||||
impl TestClient {
|
||||
pub fn new() -> TestClient {
|
||||
TestClient {
|
||||
version: "KordophoneTest-1.0",
|
||||
conversations: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl APIInterface for TestClient {
|
||||
type Error = TestError;
|
||||
|
||||
async fn get_version(&self) -> Result<String, Self::Error> {
|
||||
Ok(self.version.to_string())
|
||||
}
|
||||
|
||||
async fn get_conversations(&self) -> Result<Vec<Conversation>, Self::Error> {
|
||||
Ok(self.conversations.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user