@@ -85,11 +85,13 @@ mod tests {
85
85
86
86
use mithril_common:: test_utils:: apispec:: APISpec ;
87
87
88
+ use anyhow:: anyhow;
88
89
use serde_json:: Value :: Null ;
89
90
use warp:: { http:: Method , test:: request} ;
90
91
91
92
use crate :: {
92
- dependency_injection:: DependenciesBuilder , http_server:: SERVER_BASE_PATH , Configuration ,
93
+ dependency_injection:: DependenciesBuilder , http_server:: SERVER_BASE_PATH ,
94
+ services:: MockProverService , Configuration ,
93
95
} ;
94
96
95
97
fn setup_router (
@@ -131,4 +133,37 @@ mod tests {
131
133
& response,
132
134
) ;
133
135
}
136
+
137
+ #[ tokio:: test]
138
+ async fn proof_cardano_transaction_ko ( ) {
139
+ let config = Configuration :: new_sample ( ) ;
140
+ let mut builder = DependenciesBuilder :: new ( config) ;
141
+ let mut dependency_manager = builder. build_dependency_container ( ) . await . unwrap ( ) ;
142
+ let mut mock_prover_service = MockProverService :: new ( ) ;
143
+ mock_prover_service
144
+ . expect_compute_transactions_proofs ( )
145
+ . returning ( |_| Err ( anyhow ! ( "Error" ) ) )
146
+ . times ( 1 ) ;
147
+ dependency_manager. prover_service = Arc :: new ( mock_prover_service) ;
148
+
149
+ let method = Method :: GET . as_str ( ) ;
150
+ let path = "/proof/cardano-transaction" ;
151
+
152
+ let response = request ( )
153
+ . method ( method)
154
+ . path ( & format ! (
155
+ "/{SERVER_BASE_PATH}{path}?transaction_hashes=tx-123,tx-456"
156
+ ) )
157
+ . reply ( & setup_router ( Arc :: new ( dependency_manager) ) )
158
+ . await ;
159
+
160
+ APISpec :: verify_conformity (
161
+ APISpec :: get_all_spec_files ( ) ,
162
+ method,
163
+ path,
164
+ "application/json" ,
165
+ & Null ,
166
+ & response,
167
+ ) ;
168
+ }
134
169
}
0 commit comments