1
- use chrono:: { DateTime , Utc } ;
1
+ use chrono:: { DateTime , TimeZone , Utc } ;
2
2
use fake:: faker:: * ;
3
3
use time:: Duration ;
4
4
5
5
use crate :: targeting_tag:: fixtures:: get_targeting_tags;
6
6
use crate :: validator:: fixtures:: get_validator;
7
- use crate :: BigNum ;
7
+ use crate :: { BigNum , EventSubmission } ;
8
8
9
9
use super :: { Channel , ChannelSpec , SpecValidators , ValidatorDesc } ;
10
10
use crate :: util:: tests:: take_one;
@@ -27,6 +27,44 @@ const ASSETS_LIST: [&str; 8] = ["DAI", "BGN", "EUR", "USD", "ADX", "BTC", "LIT",
27
27
// ChannelId { bytes: id }
28
28
//}
29
29
30
+ pub fn get_dummy_channel ( ) -> Channel {
31
+ let leader = ValidatorDesc {
32
+ id : "awesomeLeader" . to_string ( ) ,
33
+ url : "http://localhost:8005" . to_string ( ) ,
34
+ fee : 100 . into ( ) ,
35
+ } ;
36
+ let follower = ValidatorDesc {
37
+ id : "awesomeFollower" . to_string ( ) ,
38
+ url : "http://localhost:8006" . to_string ( ) ,
39
+ fee : 100 . into ( ) ,
40
+ } ;
41
+ let nonce = BigNum :: from ( <Faker as Number >:: between ( 100_000_000 , 999_999_999 ) ) ;
42
+
43
+ Channel {
44
+ id : "awesomeTestChannel" . to_string ( ) ,
45
+ creator : "awesomeCreator" . to_string ( ) ,
46
+ deposit_asset : "DAI" . to_string ( ) ,
47
+ deposit_amount : 1_000 . into ( ) ,
48
+ // UNIX timestamp for 2100-01-01
49
+ valid_until : Utc . timestamp ( 4_102_444_800 , 0 ) ,
50
+ spec : ChannelSpec {
51
+ title : None ,
52
+ validators : SpecValidators ( [ leader, follower] ) ,
53
+ max_per_impression : 10 . into ( ) ,
54
+ min_per_impression : 10 . into ( ) ,
55
+ targeting : vec ! [ ] ,
56
+ min_targeting_score : None ,
57
+ event_submission : EventSubmission { allow : vec ! [ ] } ,
58
+ // July 29, 2019 7:00:00 AM
59
+ created : Utc . timestamp ( 1_564_383_600 , 0 ) ,
60
+ active_from : None ,
61
+ nonce,
62
+ withdraw_period_start : Utc . timestamp_millis ( 4_073_414_400_000 ) ,
63
+ ad_units : vec ! [ ] ,
64
+ } ,
65
+ }
66
+ }
67
+
30
68
pub fn get_channel (
31
69
id : & str ,
32
70
valid_until : & Option < DateTime < Utc > > ,
@@ -80,8 +118,6 @@ pub enum ValidatorsOption<'a> {
80
118
}
81
119
82
120
pub fn get_channel_spec ( validators_option : ValidatorsOption < ' _ > ) -> ChannelSpec {
83
- use crate :: EventSubmission ;
84
-
85
121
let validators = match validators_option {
86
122
ValidatorsOption :: Pair { leader, follower } => [ leader, follower] . into ( ) ,
87
123
ValidatorsOption :: SpecValidators ( spec_validators) => spec_validators,
0 commit comments