@@ -520,8 +520,8 @@ impl AggregatorRunnerTrait for AggregatorRunner {
520520pub mod tests {
521521 use async_trait:: async_trait;
522522 use chrono:: { DateTime , Utc } ;
523+ use mockall:: mock;
523524 use mockall:: predicate:: eq;
524- use mockall:: { mock, Sequence } ;
525525 use std:: path:: PathBuf ;
526526 use std:: sync:: Arc ;
527527 use tokio:: sync:: RwLock ;
@@ -665,9 +665,13 @@ pub mod tests {
665665 . returning ( |_| Ok ( None ) ) ;
666666 }
667667
668- fn create_open_message ( is_certified : IsCertified , is_expired : IsExpired ) -> OpenMessage {
668+ fn create_open_message (
669+ is_certified : IsCertified ,
670+ is_expired : IsExpired ,
671+ signed_entity_type : SignedEntityType ,
672+ ) -> OpenMessage {
669673 OpenMessage {
670- signed_entity_type : SignedEntityType :: CardanoImmutableFilesFull ( fake_data :: beacon ( ) ) ,
674+ signed_entity_type,
671675 is_certified : is_certified == IsCertified :: Yes ,
672676 is_expired : is_expired == IsExpired :: Yes ,
673677 ..OpenMessage :: dummy ( )
@@ -973,7 +977,11 @@ pub mod tests {
973977 #[ tokio:: test]
974978 async fn test_get_current_non_certified_open_message_should_create_new_open_message_if_none_exists (
975979 ) {
976- let open_message_created = create_open_message ( IsCertified :: No , IsExpired :: No ) ;
980+ let open_message_created = create_open_message (
981+ IsCertified :: No ,
982+ IsExpired :: No ,
983+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
984+ ) ;
977985 let open_message_expected = open_message_created. clone ( ) ;
978986
979987 let runner = {
@@ -997,7 +1005,11 @@ pub mod tests {
9971005 #[ tokio:: test]
9981006 async fn test_get_current_non_certified_open_message_should_return_existing_open_message_if_already_exists_and_not_expired (
9991007 ) {
1000- let not_certified_and_not_expired = create_open_message ( IsCertified :: No , IsExpired :: No ) ;
1008+ let not_certified_and_not_expired = create_open_message (
1009+ IsCertified :: No ,
1010+ IsExpired :: No ,
1011+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
1012+ ) ;
10011013
10021014 let open_message_expected = not_certified_and_not_expired. clone ( ) ;
10031015
@@ -1023,8 +1035,16 @@ pub mod tests {
10231035 #[ tokio:: test]
10241036 async fn test_get_current_non_certified_open_message_should_return_existing_open_message_if_already_exists_and_open_message_already_certified (
10251037 ) {
1026- let certified_and_not_expired = create_open_message ( IsCertified :: Yes , IsExpired :: No ) ;
1027- let not_certified_and_not_expired = create_open_message ( IsCertified :: No , IsExpired :: No ) ;
1038+ let certified_and_not_expired = create_open_message (
1039+ IsCertified :: Yes ,
1040+ IsExpired :: No ,
1041+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
1042+ ) ;
1043+ let not_certified_and_not_expired = create_open_message (
1044+ IsCertified :: No ,
1045+ IsExpired :: No ,
1046+ SignedEntityType :: CardanoStakeDistribution ( fake_data:: epoch ( ) ) ,
1047+ ) ;
10281048
10291049 let open_message_expected = not_certified_and_not_expired. clone ( ) ;
10301050
@@ -1041,7 +1061,7 @@ pub mod tests {
10411061 mock_certifier_service,
10421062 vec ! [
10431063 SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1044- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1064+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
10451065 ] ,
10461066 )
10471067 . await
@@ -1058,9 +1078,16 @@ pub mod tests {
10581078 #[ tokio:: test]
10591079 async fn test_get_current_non_certified_open_message_should_create_open_message_if_none_exists_and_open_message_already_certified (
10601080 ) {
1061- let certified_and_not_expired = create_open_message ( IsCertified :: Yes , IsExpired :: No ) ;
1062-
1063- let open_message_created = create_open_message ( IsCertified :: No , IsExpired :: No ) ;
1081+ let certified_and_not_expired = create_open_message (
1082+ IsCertified :: Yes ,
1083+ IsExpired :: No ,
1084+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
1085+ ) ;
1086+ let open_message_created = create_open_message (
1087+ IsCertified :: No ,
1088+ IsExpired :: No ,
1089+ SignedEntityType :: CardanoStakeDistribution ( fake_data:: epoch ( ) ) ,
1090+ ) ;
10641091 let open_message_expected = open_message_created. clone ( ) ;
10651092
10661093 let runner = {
@@ -1079,7 +1106,7 @@ pub mod tests {
10791106 mock_certifier_service,
10801107 vec ! [
10811108 SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1082- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1109+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
10831110 ] ,
10841111 )
10851112 . await
@@ -1096,8 +1123,16 @@ pub mod tests {
10961123 #[ tokio:: test]
10971124 async fn test_get_current_non_certified_open_message_should_return_none_if_all_open_message_already_certified (
10981125 ) {
1099- let certified_and_not_expired_1 = create_open_message ( IsCertified :: Yes , IsExpired :: No ) ;
1100- let certified_and_not_expired_2 = create_open_message ( IsCertified :: Yes , IsExpired :: No ) ;
1126+ let certified_and_not_expired_1 = create_open_message (
1127+ IsCertified :: Yes ,
1128+ IsExpired :: No ,
1129+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
1130+ ) ;
1131+ let certified_and_not_expired_2 = create_open_message (
1132+ IsCertified :: Yes ,
1133+ IsExpired :: No ,
1134+ SignedEntityType :: CardanoStakeDistribution ( fake_data:: epoch ( ) ) ,
1135+ ) ;
11011136
11021137 let runner = {
11031138 let mut mock_certifier_service = MockCertifierService :: new ( ) ;
@@ -1112,7 +1147,7 @@ pub mod tests {
11121147 mock_certifier_service,
11131148 vec ! [
11141149 SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1115- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1150+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
11161151 ] ,
11171152 )
11181153 . await
@@ -1129,8 +1164,16 @@ pub mod tests {
11291164 #[ tokio:: test]
11301165 async fn test_get_current_non_certified_open_message_should_return_first_not_certified_and_not_expired_open_message (
11311166 ) {
1132- let not_certified_and_expired = create_open_message ( IsCertified :: No , IsExpired :: Yes ) ;
1133- let not_certified_and_not_expired = create_open_message ( IsCertified :: No , IsExpired :: No ) ;
1167+ let not_certified_and_expired = create_open_message (
1168+ IsCertified :: No ,
1169+ IsExpired :: Yes ,
1170+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
1171+ ) ;
1172+ let not_certified_and_not_expired = create_open_message (
1173+ IsCertified :: No ,
1174+ IsExpired :: No ,
1175+ SignedEntityType :: CardanoStakeDistribution ( fake_data:: epoch ( ) ) ,
1176+ ) ;
11341177
11351178 let open_message_expected = not_certified_and_not_expired. clone ( ) ;
11361179
@@ -1147,7 +1190,7 @@ pub mod tests {
11471190 mock_certifier_service,
11481191 vec ! [
11491192 SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1150- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1193+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
11511194 ] ,
11521195 )
11531196 . await
@@ -1165,15 +1208,19 @@ pub mod tests {
11651208 async fn test_get_current_non_certified_open_message_called_for_mithril_stake_distribution ( ) {
11661209 let mut mock_certifier_service = MockCertifierService :: new ( ) ;
11671210
1168- let mut seq = Sequence :: new ( ) ;
11691211 mock_certifier_service
11701212 . expect_get_open_message ( )
11711213 . with ( eq ( SignedEntityType :: MithrilStakeDistribution (
11721214 TimePoint :: dummy ( ) . epoch ,
11731215 ) ) )
11741216 . times ( 1 )
1175- . in_sequence ( & mut seq)
1176- . return_once ( |_| Ok ( Some ( create_open_message ( IsCertified :: Yes , IsExpired :: No ) ) ) ) ;
1217+ . return_once ( |_| {
1218+ Ok ( Some ( create_open_message (
1219+ IsCertified :: Yes ,
1220+ IsExpired :: No ,
1221+ SignedEntityType :: MithrilStakeDistribution ( fake_data:: epoch ( ) ) ,
1222+ ) ) )
1223+ } ) ;
11771224
11781225 mock_certifier_service. expect_create_open_message ( ) . never ( ) ;
11791226
0 commit comments