@@ -71,6 +71,14 @@ mod handlers {
71
71
. await ,
72
72
"single_signer_authenticator::error"
73
73
) ;
74
+
75
+ if !signatures. is_authenticated ( ) {
76
+ debug ! ( "register_signatures::unauthenticated_signature" ) ;
77
+ return Ok ( reply:: bad_request (
78
+ "Could not authenticate signature" . to_string ( ) ,
79
+ "Signature could not be authenticated" . to_string ( ) ,
80
+ ) ) ;
81
+ }
74
82
}
75
83
76
84
match certifier_service
@@ -160,13 +168,11 @@ mod tests {
160
168
}
161
169
162
170
#[ tokio:: test]
163
- async fn test_register_signatures_send_unauthenticated_signature_if_authentication_fail ( ) {
171
+ async fn test_register_signatures_return_404_if_authentication_fail ( ) {
164
172
let mut mock_certifier_service = MockCertifierService :: new ( ) ;
165
173
mock_certifier_service
166
174
. expect_register_single_signature ( )
167
- . withf ( |_, signature| !signature. is_authenticated ( ) )
168
- . once ( )
169
- . return_once ( move |_, _| Ok ( RegistrationStatus :: Registered ) ) ;
175
+ . never ( ) ;
170
176
let mut dependency_manager = initialize_dependencies ( ) . await ;
171
177
dependency_manager. certifier_service = Arc :: new ( mock_certifier_service) ;
172
178
dependency_manager. single_signer_authenticator =
@@ -180,12 +186,23 @@ mod tests {
180
186
let method = Method :: POST . as_str ( ) ;
181
187
let path = "/register-signatures" ;
182
188
183
- request ( )
189
+ let response = request ( )
184
190
. method ( method)
185
191
. path ( & format ! ( "/{SERVER_BASE_PATH}{path}" ) )
186
192
. json ( & message)
187
193
. reply ( & setup_router ( Arc :: new ( dependency_manager) ) )
188
194
. await ;
195
+
196
+ APISpec :: verify_conformity (
197
+ APISpec :: get_all_spec_files ( ) ,
198
+ method,
199
+ path,
200
+ "application/json" ,
201
+ & message,
202
+ & response,
203
+ & StatusCode :: BAD_REQUEST ,
204
+ )
205
+ . unwrap ( ) ;
189
206
}
190
207
191
208
#[ tokio:: test]
0 commit comments