@@ -108,7 +108,7 @@ mod test {
108
108
use tower:: Service ;
109
109
110
110
use adapter:: Dummy ;
111
- use primitives:: { test_util:: DUMMY_CAMPAIGN , Campaign , ChainOf } ;
111
+ use primitives:: { test_util:: CAMPAIGNS , Campaign , ChainOf } ;
112
112
113
113
use crate :: {
114
114
db:: { insert_campaign, insert_channel} ,
@@ -130,7 +130,7 @@ mod test {
130
130
. expect ( "Should build Request" )
131
131
} ;
132
132
133
- let campaign = DUMMY_CAMPAIGN . clone ( ) ;
133
+ let campaign_context = CAMPAIGNS [ 0 ] . clone ( ) ;
134
134
135
135
async fn handle (
136
136
Extension ( campaign_context) : Extension < ChainOf < Campaign > > ,
@@ -147,7 +147,7 @@ mod test {
147
147
148
148
// bad CampaignId
149
149
{
150
- let mut request = build_request ( campaign . id ) ;
150
+ let mut request = build_request ( campaign_context . context . id ) ;
151
151
* request. uri_mut ( ) = "/WrongCampaignId" . parse ( ) . unwrap ( ) ;
152
152
153
153
let response = router
@@ -162,9 +162,9 @@ mod test {
162
162
) ;
163
163
}
164
164
165
- // non-existent campaign
165
+ // non-existent Campaign
166
166
{
167
- let request = build_request ( campaign . id ) ;
167
+ let request = build_request ( campaign_context . context . id ) ;
168
168
169
169
let response = router
170
170
. call ( request)
@@ -176,21 +176,18 @@ mod test {
176
176
177
177
// existing Campaign
178
178
{
179
- let channel_chain = app
180
- . config
181
- . find_chain_of ( DUMMY_CAMPAIGN . channel . token )
182
- . expect ( "Channel token should be whitelisted in config!" ) ;
183
- let channel_context = channel_chain. with_channel ( DUMMY_CAMPAIGN . channel ) ;
179
+ let channel_context = campaign_context. of_channel ( ) ;
180
+
184
181
// insert Channel
185
182
insert_channel ( & app. pool , & channel_context)
186
183
. await
187
184
. expect ( "Should insert Channel" ) ;
188
185
// insert Campaign
189
- assert ! ( insert_campaign( & app. pool, & campaign )
186
+ assert ! ( insert_campaign( & app. pool, & campaign_context . context )
190
187
. await
191
188
. expect( "Should insert Campaign" ) ) ;
192
189
193
- let request = build_request ( campaign . id ) ;
190
+ let request = build_request ( campaign_context . context . id ) ;
194
191
195
192
let response = router
196
193
. call ( request)
0 commit comments