fn reqwest_downloader_downloads() {
        let url = Url::parse(&mockito::server_url()).expect("could not parse url");
        let url = url.join("some_file.zip").expect("could not create url");

        let mock_endpoint = mock("GET", "/some_file.zip")
            .with_status(201)
            .with_header("content-type", "text/plain")
            .with_body("world")
            .create();

        let tmp_dir = TempDir::new("example").expect("could not create tempdir");
        let file_path = tmp_dir.path().join("some_file_location.txt");

        assert!(!file_path.exists());

        download(&url, &file_path.as_os_str().to_string_lossy()).expect("download failed");

        assert!(file_path.exists());
        mock_endpoint.assert();

        let file = fs::read_to_string(file_path).expect("could not read file");
        assert_eq!(file, "world");
    }
// Test that ReqwestDownloader downloads from the given url to the given file
Test that ReqwestDownloader downloads from the given url to the given file
Test that ReqwestDownloader downloads from the given url to the given file
fn reqwest_downloader_downloads() {
        let url = Url::parse(&mockito::server_url()).expect("could not parse url");
        let url = url.join("some_file.zip").expect("could not create url");
        let mock_endpoint = mock("GET", "/some_file.zip")
            .with_status(201)
            .with_header("content-type", "text/plain")
            .with_body("world")
            .create();
        let tmp_dir = TempDir::new("example").expect("could not create tempdir");
        let file_path = tmp_dir.path().join("some_file_location.txt");
        assert!(!file_path.exists());
        download(&url, &file_path.as_os_str().to_string_lossy()).expect("download failed");
        assert!(file_path.exists());
        mock_endpoint.assert();
        let file = fs::read_to_string(file_path).expect("could not read file");
        assert_eq!(file, "world");
    }
fn reqwest_downloader_downloads ( ) { let url = Url :: parse ( & mockito :: server_url ( ) ) . expect ( " " ) ; let url = url . join ( " " ) . expect ( " " ) ; let mock_endpoint = mock ( " " , " " ) . with_status ( 201 ) . with_header ( " " , " " ) . with_body ( " " ) . create ( ) ; let tmp_dir = TempDir :: new ( " " ) . expect ( " " ) ; let file_path = tmp_dir . path ( ) . join ( " " ) ; assert ! ( file_path exists ( ) ) ; download ( & url , & file_path . as_os_str ( ) . to_string_lossy ( ) ) . expect ( " " ) ; assert ! ( file_path exists ( ) ) ; mock_endpoint . assert ( ) ; let file = fs :: read_to_string ( file_path ) . expect ( " " ) ; assert_eq ! ( file " " ) ; }
Test that ReqwestDownloader downloads from the given url to the given file
Test that ReqwestDownloader downloads from the given url to the given file