@@ -88,7 +88,7 @@ impl MozAdsClient {
8888
8989    pub  fn  cycle_context_id ( & self )  -> AdsClientApiResult < String >  { 
9090        let  mut  inner = self . inner . lock ( ) ; 
91-         let  previous_context_id = inner. cycle_context_id ( ) ; 
91+         let  previous_context_id = inner. cycle_context_id ( ) ? ; 
9292        Ok ( previous_context_id) 
9393    } 
9494
@@ -159,7 +159,7 @@ impl MozAdsClientInner {
159159        Ok ( ( ) ) 
160160    } 
161161
162-     fn  cycle_context_id ( & mut  self )  -> String  { 
162+     fn  cycle_context_id ( & mut  self )  -> context_id :: ApiResult < String >  { 
163163        self . client . cycle_context_id ( ) 
164164    } 
165165
@@ -171,7 +171,7 @@ impl MozAdsClientInner {
171171            return  Err ( BuildRequestError :: EmptyConfig ) ; 
172172        } 
173173
174-         let  context_id = self . client . get_context_id ( ) . to_string ( ) ; 
174+         let  context_id = self . client . get_context_id ( ) ? ; 
175175        let  mut  request = AdRequest  { 
176176            placements :  vec ! [ ] , 
177177            context_id, 
@@ -288,7 +288,7 @@ mod tests {
288288    fn  test_build_ad_request_happy ( )  { 
289289        let  mut  mock = MockMARSClient :: new ( ) ; 
290290        mock. expect_get_context_id ( ) 
291-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
291+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
292292
293293        let  inner_component = MozAdsClientInner  { 
294294            ads_cache :  HashMap :: new ( ) , 
@@ -327,7 +327,7 @@ mod tests {
327327        let  request = inner_component
328328            . build_request_from_placement_configs ( & configs) 
329329            . unwrap ( ) ; 
330-         let  context_id = inner_component. client . get_context_id ( ) . to_string ( ) ; 
330+         let  context_id = inner_component. client . get_context_id ( ) . unwrap ( ) ; 
331331
332332        let  expected_request = AdRequest  { 
333333            context_id, 
@@ -366,7 +366,7 @@ mod tests {
366366    fn  test_build_ad_request_fails_on_duplicate_placement_id ( )  { 
367367        let  mut  mock = MockMARSClient :: new ( ) ; 
368368        mock. expect_get_context_id ( ) 
369-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
369+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
370370
371371        let  inner_component = MozAdsClientInner  { 
372372            ads_cache :  HashMap :: new ( ) , 
@@ -411,7 +411,7 @@ mod tests {
411411    fn  test_build_ad_request_fails_on_empty_configs ( )  { 
412412        let  mut  mock = MockMARSClient :: new ( ) ; 
413413        mock. expect_get_context_id ( ) 
414-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
414+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
415415
416416        let  inner_component = MozAdsClientInner  { 
417417            ads_cache :  HashMap :: new ( ) , 
@@ -428,7 +428,7 @@ mod tests {
428428    fn  test_build_placements_happy ( )  { 
429429        let  mut  mock = MockMARSClient :: new ( ) ; 
430430        mock. expect_get_context_id ( ) 
431-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
431+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
432432
433433        let  inner_component = MozAdsClientInner  { 
434434            ads_cache :  HashMap :: new ( ) , 
@@ -449,7 +449,7 @@ mod tests {
449449    fn  test_build_placements_with_empty_placement_in_response ( )  { 
450450        let  mut  mock = MockMARSClient :: new ( ) ; 
451451        mock. expect_get_context_id ( ) 
452-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
452+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
453453
454454        let  inner_component = MozAdsClientInner  { 
455455            ads_cache :  HashMap :: new ( ) , 
@@ -486,7 +486,7 @@ mod tests {
486486    fn  test_request_ads_with_missing_callback_in_response ( )  { 
487487        let  mut  mock = MockMARSClient :: new ( ) ; 
488488        mock. expect_get_context_id ( ) 
489-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
489+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
490490
491491        let  inner_component = MozAdsClientInner  { 
492492            ads_cache :  HashMap :: new ( ) , 
@@ -518,7 +518,7 @@ mod tests {
518518    fn  test_build_placements_fails_with_duplicate_placement ( )  { 
519519        let  mut  mock = MockMARSClient :: new ( ) ; 
520520        mock. expect_get_context_id ( ) 
521-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
521+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
522522
523523        let  inner_component = MozAdsClientInner  { 
524524            ads_cache :  HashMap :: new ( ) , 
@@ -572,7 +572,7 @@ mod tests {
572572        mock. expect_fetch_ads ( ) 
573573            . returning ( |_req| Ok ( get_example_happy_ad_response ( ) ) ) ; 
574574        mock. expect_get_context_id ( ) 
575-             . return_const ( "mock-context-id" . to_string ( ) ) ; 
575+             . returning ( ||  Ok ( "mock-context-id" . to_string ( ) ) ) ; 
576576
577577        mock. expect_get_mars_endpoint ( ) 
578578            . return_const ( "https://mock.endpoint/ads" . to_string ( ) ) ; 
0 commit comments