@@ -520,8 +520,8 @@ impl AggregatorRunnerTrait for AggregatorRunner {
520
520
pub mod tests {
521
521
use async_trait:: async_trait;
522
522
use chrono:: { DateTime , Utc } ;
523
+ use mockall:: mock;
523
524
use mockall:: predicate:: eq;
524
- use mockall:: { mock, Sequence } ;
525
525
use std:: path:: PathBuf ;
526
526
use std:: sync:: Arc ;
527
527
use tokio:: sync:: RwLock ;
@@ -665,9 +665,13 @@ pub mod tests {
665
665
. returning ( |_| Ok ( None ) ) ;
666
666
}
667
667
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 {
669
673
OpenMessage {
670
- signed_entity_type : SignedEntityType :: CardanoImmutableFilesFull ( fake_data :: beacon ( ) ) ,
674
+ signed_entity_type,
671
675
is_certified : is_certified == IsCertified :: Yes ,
672
676
is_expired : is_expired == IsExpired :: Yes ,
673
677
..OpenMessage :: dummy ( )
@@ -973,7 +977,11 @@ pub mod tests {
973
977
#[ tokio:: test]
974
978
async fn test_get_current_non_certified_open_message_should_create_new_open_message_if_none_exists (
975
979
) {
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
+ ) ;
977
985
let open_message_expected = open_message_created. clone ( ) ;
978
986
979
987
let runner = {
@@ -997,7 +1005,11 @@ pub mod tests {
997
1005
#[ tokio:: test]
998
1006
async fn test_get_current_non_certified_open_message_should_return_existing_open_message_if_already_exists_and_not_expired (
999
1007
) {
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
+ ) ;
1001
1013
1002
1014
let open_message_expected = not_certified_and_not_expired. clone ( ) ;
1003
1015
@@ -1023,8 +1035,16 @@ pub mod tests {
1023
1035
#[ tokio:: test]
1024
1036
async fn test_get_current_non_certified_open_message_should_return_existing_open_message_if_already_exists_and_open_message_already_certified (
1025
1037
) {
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
+ ) ;
1028
1048
1029
1049
let open_message_expected = not_certified_and_not_expired. clone ( ) ;
1030
1050
@@ -1041,7 +1061,7 @@ pub mod tests {
1041
1061
mock_certifier_service,
1042
1062
vec ! [
1043
1063
SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1044
- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1064
+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
1045
1065
] ,
1046
1066
)
1047
1067
. await
@@ -1058,9 +1078,16 @@ pub mod tests {
1058
1078
#[ tokio:: test]
1059
1079
async fn test_get_current_non_certified_open_message_should_create_open_message_if_none_exists_and_open_message_already_certified (
1060
1080
) {
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
+ ) ;
1064
1091
let open_message_expected = open_message_created. clone ( ) ;
1065
1092
1066
1093
let runner = {
@@ -1079,7 +1106,7 @@ pub mod tests {
1079
1106
mock_certifier_service,
1080
1107
vec ! [
1081
1108
SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1082
- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1109
+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
1083
1110
] ,
1084
1111
)
1085
1112
. await
@@ -1096,8 +1123,16 @@ pub mod tests {
1096
1123
#[ tokio:: test]
1097
1124
async fn test_get_current_non_certified_open_message_should_return_none_if_all_open_message_already_certified (
1098
1125
) {
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
+ ) ;
1101
1136
1102
1137
let runner = {
1103
1138
let mut mock_certifier_service = MockCertifierService :: new ( ) ;
@@ -1112,7 +1147,7 @@ pub mod tests {
1112
1147
mock_certifier_service,
1113
1148
vec ! [
1114
1149
SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1115
- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1150
+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
1116
1151
] ,
1117
1152
)
1118
1153
. await
@@ -1129,8 +1164,16 @@ pub mod tests {
1129
1164
#[ tokio:: test]
1130
1165
async fn test_get_current_non_certified_open_message_should_return_first_not_certified_and_not_expired_open_message (
1131
1166
) {
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
+ ) ;
1134
1177
1135
1178
let open_message_expected = not_certified_and_not_expired. clone ( ) ;
1136
1179
@@ -1147,7 +1190,7 @@ pub mod tests {
1147
1190
mock_certifier_service,
1148
1191
vec ! [
1149
1192
SignedEntityTypeDiscriminants :: MithrilStakeDistribution ,
1150
- SignedEntityTypeDiscriminants :: CardanoImmutableFilesFull ,
1193
+ SignedEntityTypeDiscriminants :: CardanoStakeDistribution ,
1151
1194
] ,
1152
1195
)
1153
1196
. await
@@ -1165,15 +1208,19 @@ pub mod tests {
1165
1208
async fn test_get_current_non_certified_open_message_called_for_mithril_stake_distribution ( ) {
1166
1209
let mut mock_certifier_service = MockCertifierService :: new ( ) ;
1167
1210
1168
- let mut seq = Sequence :: new ( ) ;
1169
1211
mock_certifier_service
1170
1212
. expect_get_open_message ( )
1171
1213
. with ( eq ( SignedEntityType :: MithrilStakeDistribution (
1172
1214
TimePoint :: dummy ( ) . epoch ,
1173
1215
) ) )
1174
1216
. 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
+ } ) ;
1177
1224
1178
1225
mock_certifier_service. expect_create_open_message ( ) . never ( ) ;
1179
1226
0 commit comments