File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 1
- use crate :: Channel ;
2
- use crate :: { BalancesMap , BigNum } ;
1
+ use std :: pin :: Pin ;
2
+
3
3
use chrono:: { DateTime , Utc } ;
4
4
use futures:: prelude:: * ;
5
5
use serde:: { Deserialize , Serialize } ;
6
- use std:: pin:: Pin ;
6
+
7
+ use crate :: Channel ;
8
+ use crate :: { BalancesMap , BigNum } ;
7
9
8
10
pub type ValidatorFuture < T > = Pin < Box < dyn Future < Output = Result < T , ValidatorError > > + Send > > ;
9
11
@@ -104,3 +106,22 @@ pub enum MessageTypes {
104
106
Heartbeat ( Heartbeat ) ,
105
107
Accounting ( Accounting ) ,
106
108
}
109
+
110
+ pub mod fixtures {
111
+ use fake:: faker:: * ;
112
+
113
+ use crate :: BigNum ;
114
+
115
+ use super :: ValidatorDesc ;
116
+
117
+ pub fn get_validator < V : AsRef < str > > ( validator_id : V , fee : Option < BigNum > ) -> ValidatorDesc {
118
+ let fee = fee. unwrap_or_else ( || BigNum :: from ( <Faker as Number >:: between ( 1 , 13 ) ) ) ;
119
+ let url = format ! (
120
+ "http://{}-validator-url.com/validator" ,
121
+ validator_id. as_ref( )
122
+ ) ;
123
+ let id = validator_id. as_ref ( ) . to_string ( ) ;
124
+
125
+ ValidatorDesc { id, url, fee }
126
+ }
127
+ }
You can’t perform that action at this time.
0 commit comments