hms_test_utils/
lib.rs

1use hms_common::app_dir_client::AppDirClient;
2use std::{io::Error, path::PathBuf};
3use tempfile::TempDir;
4
5pub struct TestAppDirClient {
6    pub app_dir_path: PathBuf,
7}
8
9impl AppDirClient for TestAppDirClient {
10    fn get_app_dir_path(&self) -> Result<PathBuf, Error> {
11        Ok(self.app_dir_path.clone())
12    }
13}
14
15pub fn test_app_dir_client() -> (TempDir, TestAppDirClient) {
16    let temp_dir = tempfile::tempdir().unwrap();
17    let temp_path = temp_dir.path().to_owned();
18    let mock_client = TestAppDirClient {
19        app_dir_path: temp_path,
20    };
21    (temp_dir, mock_client)
22}