- update: database client to implement a database trait so we can mock it out

- update unit tests
- add: database client mock
This commit is contained in:
2024-11-25 22:20:15 -05:00
parent 3ff22c9a5b
commit 3fc6c6252c
15 changed files with 181 additions and 103 deletions

View File

@@ -1,11 +1,13 @@
use deadpool_redis::{Config, Pool, Runtime};
use redis::AsyncCommands;
use database_service::redis_cache::RedisCache;
use dotenv::dotenv;
#[tokio::test]
async fn test_redis_cache() {
let redis_url = "redis://127.0.0.1:6379";
let cache = RedisCache::new(redis_url);
dotenv().ok();
let redis_url = std::env::var("REDIS_URL").unwrap_or_else(|_| "redis://127.0.0.1:6379".to_string());
let cache = RedisCache::new(&redis_url);
let key = &"test_key".to_string();
let value = "test_value";