1010//! <img src="../logo.jpeg" width="200px"/>
1111//!
1212
13- use clap:: { Parser , Subcommand } ;
13+ use clap:: Parser ;
1414use futures:: StreamExt ;
1515use log:: { debug, error, info, trace, warn, LevelFilter } ;
1616use semver:: Version ;
@@ -290,23 +290,6 @@ pub fn query_and_fetch_yaml_document(
290290 HarpoonError :: InvalidResponse ( format ! ( "Failed to join URL with package name: {err}" ) )
291291 } ) ?;
292292
293- // // Send an Update Download Finished event to the server as best effort. Do
294- // // not fail the query if the event fails to send.
295- // if let Err(err) = report_omaha_event(
296- // url,
297- // app_id,
298- // track,
299- // OmahaEventType::UpdateDownloadFinished,
300- // match response_result {
301- // Ok(_) => EventResult::Success,
302- // Err(_) => EventResult::Error,
303- // },
304- // machine_id_source,
305- // ) {
306- // error!("Failed to send UpdateDownloadFinished event to server at '{url}': {err}");
307- // }
308-
309- // Now let's report that we dowloaded the update!
310293 debug ! (
311294 "Downloaded update for app '{}' v{} to v{}" ,
312295 app_id, document_version, new_version
@@ -330,6 +313,7 @@ pub fn query_and_fetch_yaml_document(
330313///
331314/// The function takes care of validating the size and hash of the downloaded
332315/// document.
316+ #[ allow( unused) ]
333317fn download_document (
334318 update_base_url : & Url ,
335319 package : & Package ,
@@ -490,15 +474,6 @@ mod tests {
490474
491475 let data = "test document" ;
492476
493- let document_mock = server
494- . mock ( "GET" , "/test.yaml" )
495- . with_body ( data)
496- . with_header ( "content-length" , & data. len ( ) . to_string ( ) )
497- . with_header ( "content-type" , "text/plain" )
498- . with_status ( 200 )
499- . expect ( 1 )
500- . create ( ) ;
501-
502477 let omaha_mock = server
503478 . mock ( "POST" , "/" )
504479 . with_status ( 200 )
@@ -528,20 +503,20 @@ mod tests {
528503 . expect ( 1 )
529504 . create ( ) ;
530505
531- let omaha_event_mock = server
532- . mock ( "POST" , "/" )
533- . with_status ( 200 )
534- . match_body ( Matcher :: Regex ( ".*<event.*" . to_string ( ) ) )
535- . with_body ( indoc:: indoc! { r#"
536- <?xml version="1.0" encoding="UTF-8"?>
537- <response protocol="3.0" server="mock">
538- <daystart elapsed_seconds="0"/>
539- <app appid="test" status="ok">
540- <event status="ok"/>
541- </app>
542- </response>"# } )
543- . expect ( 1 )
544- . create ( ) ;
506+ // let omaha_event_mock = server
507+ // .mock("POST", "/")
508+ // .with_status(200)
509+ // .match_body(Matcher::Regex(".*<event.*".to_string()))
510+ // .with_body(indoc::indoc! {r#"
511+ // <?xml version="1.0" encoding="UTF-8"?>
512+ // <response protocol="3.0" server="mock">
513+ // <daystart elapsed_seconds="0"/>
514+ // <app appid="test" status="ok">
515+ // <event status="ok"/>
516+ // </app>
517+ // </response>"#})
518+ // .expect(1)
519+ // .create();
545520
546521 let response = query_and_fetch_yaml_document (
547522 & Url :: parse ( & server. url ( ) ) . unwrap ( ) ,
@@ -552,9 +527,8 @@ mod tests {
552527 )
553528 . unwrap ( ) ;
554529
555- document_mock. assert ( ) ;
556530 omaha_mock. assert ( ) ;
557- omaha_event_mock. assert ( ) ;
531+ // omaha_event_mock.assert();
558532
559533 assert_eq ! (
560534 response,
@@ -563,7 +537,6 @@ mod tests {
563537 result: QueryResult :: NewDocument {
564538 url: Url :: parse( & format!( "{}/test.yaml" , server. url( ) ) ) . unwrap( ) ,
565539 version: Version :: new( 1 , 0 , 0 ) ,
566- document: data. to_string( ) ,
567540 }
568541 }
569542 ) ;
0 commit comments