use crate::arango_api::{ArangoQuery, ExecuteArangoQuery};
use std::collections::HashMap;
#[allow(dead_code)] pub struct ArangoMock {
requests_and_responses: HashMap<String, String>,
}
impl ArangoMock {
#[must_use]
#[allow(dead_code)] pub fn new(requests_and_responses: HashMap<String, String>) -> Self {
Self { requests_and_responses }
}
}
impl ExecuteArangoQuery for ArangoMock {
type Output = String;
fn execute_query(&self, query: ArangoQuery) -> <Self as ExecuteArangoQuery>::Output {
self.requests_and_responses
.get(&serde_json::to_string(&query).unwrap())
.map(ToOwned::to_owned)
.unwrap_or_default()
}
}