@@ -14,25 +14,25 @@ use primitives::{
1414 AdUnit as ResponseAdUnit , Campaign as ResponseCampaign , UnitsWithPrice ,
1515 } ,
1616 } ,
17- targeting:: { Function , Rules , Value } ,
17+ targeting:: Rules ,
1818 test_util:: { CAMPAIGNS , DUMMY_AD_UNITS , DUMMY_IPFS , IDS , PUBLISHER } ,
1919 unified_num:: FromWhole ,
20+ util:: logging:: new_logger,
2021 AdSlot ,
2122} ;
2223
24+ use wiremock:: {
25+ matchers:: { method, path} ,
26+ Mock , MockServer , ResponseTemplate ,
27+ } ;
28+
2329use super :: * ;
2430use crate :: {
2531 routes:: campaign:: create_campaign,
2632 test_util:: { setup_dummy_app, ApplicationGuard } ,
2733 Auth ,
2834} ;
2935
30- // use url::Url;
31- use wiremock:: {
32- matchers:: { method, path} ,
33- Mock , MockServer , ResponseTemplate ,
34- } ;
35-
3636// User Agent OS: Linux (only in `woothee`)
3737// User Agent Browser Family: Firefox
3838const LINUX_FIREFOX_USER_AGENT : & str =
@@ -47,13 +47,18 @@ async fn setup_mocked_platform_dummy_app() -> (MockServer, ApplicationGuard) {
4747 let platform_url = mock_server. uri ( ) . parse ( ) . unwrap ( ) ;
4848
4949 let mut app_guard = setup_dummy_app ( ) . await ;
50+ app_guard. app . logger = new_logger ( "sentry-dummy-app" ) ;
51+ debug ! (
52+ & app_guard. app. logger,
53+ "With platform mocker server at {}" , & platform_url
54+ ) ;
55+
5056 app_guard. app . platform_api . platform_url = platform_url;
5157
5258 ( mock_server, app_guard)
5359}
5460
5561#[ tokio:: test]
56- #[ ignore = "Fix test" ]
5762async fn test_targeting_input ( ) {
5863 let ( mock_server, app_guard) = setup_mocked_platform_dummy_app ( ) . await ;
5964 let app = Arc :: new ( app_guard. app ) ;
@@ -71,7 +76,7 @@ async fn test_targeting_input() {
7176 [
7277 (
7378 GANACHE_INFO_1 . tokens [ "Mocked TOKEN 1" ] . address ,
74- UnifiedNum :: from_whole ( 0.0007 ) ,
79+ UnifiedNum :: from_whole ( 0.010 ) ,
7580 ) ,
7681 (
7782 GANACHE_INFO_1337 . tokens [ "Mocked TOKEN 1337" ] . address ,
@@ -103,8 +108,7 @@ async fn test_targeting_input() {
103108 deposit,
104109 ) ;
105110
106- CAMPAIGNS [ 0 ] /* .context */
107- . clone ( )
111+ CAMPAIGNS [ 0 ] . clone ( )
108112 } ;
109113
110114 let campaign_1 = {
@@ -119,8 +123,7 @@ async fn test_targeting_input() {
119123 deposit,
120124 ) ;
121125
122- CAMPAIGNS [ 1 ] /* .context */
123- . clone ( )
126+ CAMPAIGNS [ 1 ] . clone ( )
124127 } ;
125128
126129 let matching_campaign_2 = {
@@ -135,14 +138,7 @@ async fn test_targeting_input() {
135138 deposit,
136139 ) ;
137140
138- let min_impression_price =
139- Function :: new_only_show_if ( Function :: new_get ( "eventMinPrice" ) ) ;
140-
141- let mut campaign_2 = CAMPAIGNS [ 2 ] /* .context */
142- . clone ( ) ;
143- campaign_2. context . targeting_rules = Rules ( vec ! [ min_impression_price. into( ) ] ) ;
144-
145- campaign_2
141+ CAMPAIGNS [ 2 ] . clone ( )
146142 } ;
147143
148144 [ campaign_0, campaign_1, matching_campaign_2]
@@ -253,8 +249,12 @@ async fn test_targeting_input() {
253249 . expect ( "Should return response" )
254250 . 0 ;
255251
256- // pub targeting_input_base: Input,
257- // assert_eq!(response.targeting_input_base);
252+ debug ! ( & app. logger, "{:?}" , response. targeting_input_base) ;
253+ assert_eq ! (
254+ response. targeting_input_base. global. publisher_id,
255+ * PUBLISHER
256+ ) ;
257+
258258 assert ! ( response. accepted_referrers. is_empty( ) ) ;
259259 let expected_fallback_until = ResponseAdUnit {
260260 ipfs : fallback_unit. ipfs ,
0 commit comments