Skip to content

Commit 901880a

Browse files
committed
requested changes
1 parent 10d6c9c commit 901880a

File tree

2 files changed

+17
-37
lines changed

2 files changed

+17
-37
lines changed

sentry/src/routes/channel.rs

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,12 +1269,9 @@ mod test {
12691269

12701270
// Testing for no accounting yet
12711271
{
1272-
let res =
1272+
let accounting_response =
12731273
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone()))
1274-
.await;
1275-
assert!(res.is_ok());
1276-
1277-
let accounting_response = res.unwrap();
1274+
.await.expect("shoul get accounting");
12781275

12791276
assert_eq!(accounting_response.balances.earners.len(), 0);
12801277
assert_eq!(accounting_response.balances.spenders.len(), 0);
@@ -1297,12 +1294,9 @@ mod test {
12971294
.await
12981295
.expect("should spend");
12991296

1300-
let res =
1297+
let accounting_response =
13011298
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone()))
1302-
.await;
1303-
assert!(res.is_ok());
1304-
1305-
let accounting_response = res.unwrap();
1299+
.await.expect("should get accounting");
13061300

13071301
assert_eq!(balances, accounting_response.balances);
13081302
}
@@ -1333,12 +1327,9 @@ mod test {
13331327
.await
13341328
.expect("should spend");
13351329

1336-
let res =
1330+
let accounting_response =
13371331
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone()))
1338-
.await;
1339-
assert!(res.is_ok());
1340-
1341-
let accounting_response = res.unwrap();
1332+
.await.expect("shoul get accounting");
13421333

13431334
assert_eq!(balances, accounting_response.balances)
13441335
}
@@ -1395,14 +1386,10 @@ mod test {
13951386
Extension(channel_context.clone()),
13961387
Path((channel_context.context.id(), *CREATOR)),
13971388
)
1398-
.await;
1399-
assert!(res.is_ok());
1400-
1401-
let res =
1402-
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone())).await;
1403-
assert!(res.is_ok());
1389+
.await.expect("should get spender leaf");
14041390

1405-
let accounting_response = res.unwrap();
1391+
let accounting_response =
1392+
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone())).await.expect("should get accounting");
14061393

14071394
// Making sure a new entry has been created
14081395
assert_eq!(
@@ -1425,11 +1412,8 @@ mod test {
14251412
.await
14261413
.expect("should spend");
14271414

1428-
let res =
1429-
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone())).await;
1430-
assert!(res.is_ok());
1431-
1432-
let accounting_response = res.unwrap();
1415+
let accounting_response =
1416+
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone())).await.expect("should get accounting");
14331417

14341418
assert_eq!(balances, accounting_response.balances);
14351419

@@ -1441,11 +1425,8 @@ mod test {
14411425
.await;
14421426
assert!(res.is_ok());
14431427

1444-
let res =
1445-
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone())).await;
1446-
assert!(res.is_ok());
1447-
1448-
let accounting_response = res.unwrap();
1428+
let accounting_response =
1429+
get_accounting_for_channel_axum(app.clone(), Extension(channel_context.clone())).await.expect("should get accounting");
14491430

14501431
// Balances shouldn't change
14511432
assert_eq!(

sentry/src/routes/routers.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,13 @@ pub fn channels_router_axum<C: Locked + 'static>() -> Router {
139139
.route(
140140
"/:addr",
141141
get(get_spender_limits_axum::<C>)
142-
.post(add_spender_leaf_axum::<C>)
143-
.route_layer(middleware::from_fn(authentication_required::<C, _>)),
142+
.post(add_spender_leaf_axum::<C>),
144143
)
145144
.route(
146145
"/all",
147-
get(get_all_spender_limits_axum::<C>)
148-
.route_layer(middleware::from_fn(authentication_required::<C, _>)),
149-
);
146+
get(get_all_spender_limits_axum::<C>),
147+
)
148+
.layer(middleware::from_fn(authentication_required::<C, _>));
150149

151150
let channel_routes = Router::new()
152151
.route(

0 commit comments

Comments
 (0)