Skip to content

Commit e2c163c

Browse files
Fix warnings in the tests
1 parent 92556e2 commit e2c163c

File tree

6 files changed

+24
-27
lines changed

6 files changed

+24
-27
lines changed

rust/rbac-registration/src/cardano/cip509/cip509.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,11 @@ fn decode_validation_signature(
547547
#[cfg(test)]
548548
mod tests {
549549
use super::*;
550-
use crate::utils::test::test_block_1;
550+
use crate::utils::test;
551551

552552
#[test]
553553
fn new() {
554-
let block = test_block_1();
554+
let block = test::block_1();
555555
let index = TxnIndex::from(3);
556556
let res = Cip509::new(&block, index, &[])
557557
.expect("Failed to get Cip509")
@@ -561,7 +561,7 @@ mod tests {
561561

562562
#[test]
563563
fn from_block() {
564-
let block = test_block_1();
564+
let block = test::block_1();
565565
let res = Cip509::from_block(&block, &[]);
566566
assert_eq!(1, res.len());
567567
let cip509 = res.first().unwrap();

rust/rbac-registration/src/cardano/cip509/utils/cip134_uri_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,11 @@ fn extract_c509_uris(certificates: &[C509Cert], report: &ProblemReport) -> UrisM
262262
mod tests {
263263
use pallas::ledger::addresses::{Address, Network};
264264

265-
use crate::{cardano::cip509::Cip509, utils::test::test_block_1};
265+
use crate::{cardano::cip509::Cip509, utils::test};
266266

267267
#[test]
268268
fn set_new() {
269-
let block = test_block_1();
269+
let block = test::block_1();
270270
let cip509 = Cip509::new(&block, 3.into(), &[]).unwrap().unwrap();
271271
assert!(
272272
!cip509.report().is_problematic(),

rust/rbac-registration/src/cardano/cip509/validation.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,11 @@ mod tests {
207207
use uuid::Uuid;
208208

209209
use super::*;
210-
use crate::{
211-
cardano::cip509::Cip509,
212-
utils::test::{test_block_1, test_block_2, test_block_3, test_block_4},
213-
};
210+
use crate::{cardano::cip509::Cip509, utils::test};
214211

215212
#[test]
216213
fn block_1() {
217-
let block = test_block_1();
214+
let block = test::block_1();
218215

219216
let mut registrations = Cip509::from_block(&block, &[]);
220217
assert_eq!(1, registrations.len());
@@ -241,7 +238,7 @@ mod tests {
241238

242239
#[test]
243240
fn block_2() {
244-
let block = test_block_2();
241+
let block = test::block_2();
245242

246243
let mut registrations = Cip509::from_block(&block, &[]);
247244
assert_eq!(1, registrations.len());
@@ -262,7 +259,7 @@ mod tests {
262259

263260
#[test]
264261
fn block_3() {
265-
let block = test_block_3();
262+
let block = test::block_3();
266263

267264
let mut registrations = Cip509::from_block(&block, &[]);
268265
assert_eq!(1, registrations.len());
@@ -297,7 +294,7 @@ mod tests {
297294

298295
#[test]
299296
fn block_4() {
300-
let block = test_block_4();
297+
let block = test::block_4();
301298

302299
let mut registrations = Cip509::from_block(&block, &[]);
303300
assert_eq!(1, registrations.len());
@@ -332,7 +329,7 @@ mod tests {
332329

333330
#[test]
334331
fn extract_stake_addresses_from_metadata() {
335-
let block = test_block_1();
332+
let block = test::block_1();
336333
let cip509 = Cip509::new(&block, 3.into(), &[]).unwrap().unwrap();
337334
assert!(
338335
!cip509.report().is_problematic(),

rust/rbac-registration/src/cardano/cip509/x509_chunks.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ mod tests {
116116
use pallas::ledger::traverse::MultiEraTx;
117117

118118
use super::*;
119-
use crate::{cardano::cip509::PointTxnIdx, utils::test::test_block_3};
119+
use crate::{cardano::cip509::PointTxnIdx, utils::test};
120120

121121
// RAW data: 10
122122
const RAW: &str =
@@ -135,7 +135,7 @@ mod tests {
135135
let mut report = ProblemReport::new("X509Chunks");
136136
// We don't care about actual values in the context, all we want is to check the decoding
137137
// of differently compressed data.
138-
let block = test_block_3();
138+
let block = test::block_3();
139139
let transactions = block.txs();
140140
let MultiEraTx::Conway(txn) = transactions.first().unwrap() else {
141141
panic!("Unexpected transaction type");
@@ -168,7 +168,7 @@ mod tests {
168168
let mut report = ProblemReport::new("X509Chunks");
169169
// We don't care about actual values in the context, all we want is to check the decoding
170170
// of differently compressed data.
171-
let block = test_block_3();
171+
let block = test::block_3();
172172
let transactions = block.txs();
173173
let MultiEraTx::Conway(txn) = transactions.first().unwrap() else {
174174
panic!("Unexpected transaction type");
@@ -201,7 +201,7 @@ mod tests {
201201
let mut report = ProblemReport::new("X509Chunks");
202202
// We don't care about actual values in the context, all we want is to check the decoding
203203
// of differently compressed data.
204-
let block = test_block_3();
204+
let block = test::block_3();
205205
let transactions = block.txs();
206206
let MultiEraTx::Conway(txn) = transactions.first().unwrap() else {
207207
panic!("Unexpected transaction type");

rust/rbac-registration/src/registration/cardano/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,11 @@ fn update_role_data(
411411
#[cfg(test)]
412412
mod test {
413413
use super::*;
414-
use crate::utils::test::{test_block_1, test_block_2, test_block_4};
414+
use crate::utils::test;
415415

416416
#[test]
417417
fn multiple_registrations() {
418-
let block = test_block_1();
418+
let block = test::block_1();
419419
let registration = Cip509::new(&block, 3.into(), &[]).unwrap().unwrap();
420420
assert!(
421421
!registration.report().is_problematic(),
@@ -431,11 +431,11 @@ mod test {
431431
.unwrap()]);
432432
assert_eq!(1, chain.x509_certs().len());
433433
let origin = &chain.x509_certs().get(&0).unwrap().0;
434-
assert_eq!(origin.point().slot_or_default(), 77429134.into());
434+
assert_eq!(origin.point().slot_or_default(), 77_429_134.into());
435435
assert_eq!(origin.txn_index(), 3.into());
436436

437437
// Try to add an invalid registration.
438-
let block = test_block_2();
438+
let block = test::block_2();
439439
let registration = Cip509::new(&block, 0.into(), &[]).unwrap().unwrap();
440440
assert!(registration.report().is_problematic());
441441

@@ -448,7 +448,7 @@ mod test {
448448
);
449449

450450
// Add the second registration.
451-
let block = test_block_4();
451+
let block = test::block_4();
452452
let registration = Cip509::new(&block, 1.into(), &[]).unwrap().unwrap();
453453
assert!(
454454
!registration.report().is_problematic(),

rust/rbac-registration/src/utils/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ use cardano_blockchain_types::{MultiEraBlock, Network, Point};
44

55
/// Returns the decoded `conway_1.block` block that contains one transaction (index = 3)
66
/// with the `Cip509` data.
7-
pub fn test_block_1() -> MultiEraBlock {
7+
pub fn block_1() -> MultiEraBlock {
88
let data = hex::decode(include_str!("../test_data/cardano/conway_1.block")).unwrap();
99
block(data)
1010
}
1111

1212
/// Returns the decoded `conway_2.block` block that contains one transaction (index = 0).
1313
/// This registration contains an invalid public key that isn't present in the transaction
1414
/// witness set.
15-
pub fn test_block_2() -> MultiEraBlock {
15+
pub fn block_2() -> MultiEraBlock {
1616
let data = hex::decode(include_str!("../test_data/cardano/conway_2.block")).unwrap();
1717
block(data)
1818
}
1919

2020
/// Returns the decoded `conway_3.block` block that contains one transaction (index = 0)
2121
/// with the `Cip509` data.
22-
pub fn test_block_3() -> MultiEraBlock {
22+
pub fn block_3() -> MultiEraBlock {
2323
let data = hex::decode(include_str!("../test_data/cardano/conway_3.block")).unwrap();
2424
block(data)
2525
}
2626

2727
/// Returns the decoded `conway_4.block` block that contains one transaction (index = 1)
2828
/// with the `Cip509` data.
29-
pub fn test_block_4() -> MultiEraBlock {
29+
pub fn block_4() -> MultiEraBlock {
3030
let data = hex::decode(include_str!("../test_data/cardano/conway_4.block")).unwrap();
3131
block(data)
3232
}

0 commit comments

Comments
 (0)