Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Mar 2, 2022
1 parent 460e558 commit 078ed4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion beacon_node/execution_layer/src/engine_api/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ mod tests {
let token = auth.generate_token_with_claims(&claims).unwrap();

assert_eq!(
Auth::validate_token(&token, JwtKey::from_slice(&JWT_SECRET).unwrap(),)
Auth::validate_token(&token, &JwtKey::from_slice(&JWT_SECRET).unwrap())
.unwrap()
.claims,
claims
Expand Down
5 changes: 3 additions & 2 deletions beacon_node/execution_layer/src/engine_api/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ impl EngineApi for HttpJsonRpc {

#[cfg(test)]
mod test {
use super::auth::JwtKey;
use super::*;
use crate::test_utils::{MockServer, JWT_SECRET};
use std::future::Future;
Expand All @@ -217,8 +218,8 @@ mod test {
let echo_url = SensitiveUrl::parse(&format!("{}/echo", server.url())).unwrap();
// Create rpc clients that include JWT auth headers if `with_auth` is true.
let (rpc_client, echo_client) = if with_auth {
let rpc_auth = Auth::new(JWT_SECRET, None, None).unwrap();
let echo_auth = Auth::new(JWT_SECRET, None, None).unwrap();
let rpc_auth = Auth::new(JwtKey::from_slice(&JWT_SECRET).unwrap(), None, None);
let echo_auth = Auth::new(JwtKey::from_slice(&JWT_SECRET).unwrap(), None, None);
(
Arc::new(HttpJsonRpc::new_with_auth(rpc_url, rpc_auth).unwrap()),
Arc::new(HttpJsonRpc::new_with_auth(echo_url, echo_auth).unwrap()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ impl<T: EthSpec> MockExecutionLayer<T> {
let file = NamedTempFile::new().unwrap();

let path = file.path().into();
std::fs::write(&path, JWT_SECRET).unwrap();
std::fs::write(&path, hex::encode(JWT_SECRET)).unwrap();

let config = Config {
execution_endpoints: vec![url],
secret_files: vec![path],
Expand Down

0 comments on commit 078ed4c

Please sign in to comment.