Skip to content

Commit bfedfb4

Browse files
committed
clean up cardano cli mock
1 parent 8686eaa commit bfedfb4

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

src/vit-testing/mainnet-tools/src/cardano_cli/mock/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,26 @@ mod command;
44
pub mod fake;
55

66
pub use command::Command;
7+
use std::path::{Path, PathBuf};
8+
9+
/// Cardano CLI mock. It can return arbitrary/fake data but preserves correct Cardano CLI format.
10+
#[derive(Debug, Clone)]
11+
pub struct Mock {
12+
path: PathBuf,
13+
}
14+
15+
impl Default for Mock {
16+
fn default() -> Self {
17+
Self {
18+
path: Path::new("cardano-cli-mock").to_path_buf(),
19+
}
20+
}
21+
}
22+
23+
impl Mock {
24+
/// Path to mock cli
25+
#[must_use]
26+
pub fn path(&self) -> PathBuf {
27+
self.path.clone()
28+
}
29+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod mock;
22
mod wrapper;
33

4-
pub use mock::Command as MockCommand;
4+
pub use mock::{Mock, Command as MockCommand};
5+
pub use wrapper::Api;
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#![allow(dead_code)]
2-
31
pub mod cli;
42
mod data;
53
mod error;
64
pub mod utils;
75

8-
pub use cli::{command::*, Api};
6+
pub use cli::Api;
97
pub use data::CardanoKeyTemplate;
108
pub use error::Error;

src/vit-testing/mainnet-tools/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#[macro_use]
77
extern crate prettytable;
88

9+
#[allow(dead_code)]
910
/// Cardano CLI wrapper and mock
1011
pub mod cardano_cli;
1112
/// Simple scheduler for transporting snapshot from snapshot trigger service to servicing station service

0 commit comments

Comments
 (0)