fn create_server() -> Server {
        let tempfile = NamedTempFile::new().unwrap();

        // Populate the database.
        //
        // FIXME: This should be handled by a server object, to avoid duplication between code and
        // tests.
        let pool = persistence::get_connection_pool(tempfile.path().to_str().unwrap()).unwrap();
        let connection = pool.get().unwrap();
        let schema = {
            let mut schema_file = File::open("schema.sql").unwrap();
            let mut schema = String::new();
            schema_file.read_to_string(&mut schema).unwrap();
            schema
        };

        connection.batch_execute(&schema).unwrap();
        crate::blog::create_fts_index(&connection).unwrap();

        let handler = super::handler(
            Config {
                resume_link: Url::parse("http://google.com").unwrap(),
            },
            vec![],
            pool,
        )
        .unwrap();
        Server {
            handler,
            database: tempfile,
        }
    }
/// Creates a handler for the website.
///
/// Returns a pair containing the handler, and a tempfile containing a test sqlite database.
Creates a handler for the website.
Returns a pair containing the handler, and a tempfile containing a test sqlite database.
Creates a handler for the website . Returns a pair containing the handler and a tempfile containing a test sqlite database .
fn create_server() -> Server {
        let tempfile = NamedTempFile::new().unwrap();
        // Populate the database.
        //
        // FIXME: This should be handled by a server object, to avoid duplication between code and
        // tests.
        let pool = persistence::get_connection_pool(tempfile.path().to_str().unwrap()).unwrap();
        let connection = pool.get().unwrap();
        let schema = {
            let mut schema_file = File::open("schema.sql").unwrap();
            let mut schema = String::new();
            schema_file.read_to_string(&mut schema).unwrap();
            schema
        };
        connection.batch_execute(&schema).unwrap();
        crate::blog::create_fts_index(&connection).unwrap();
        let handler = super::handler(
            Config {
                resume_link: Url::parse("http://google.com").unwrap(),
            },
            vec![],
            pool,
        )
        .unwrap();
        Server {
            handler,
            database: tempfile,
        }
    }
fn create_server ( ) -> Server { let tempfile = NamedTempFile :: new ( ) . unwrap ( ) ; // Populate the database. // // FIXME: This should be handled by a server object, to avoid duplication between code and // tests. let pool = persistence :: get_connection_pool ( tempfile . path ( ) . to_str ( ) . unwrap ( ) ) . unwrap ( ) ; let connection = pool . get ( ) . unwrap ( ) ; let schema = { let mut schema_file = File :: open ( " " ) . unwrap ( ) ; let mut schema = String :: new ( ) ; schema_file . read_to_string ( & mut schema ) . unwrap ( ) ; schema } ; connection . batch_execute ( & schema ) . unwrap ( ) ; crate :: blog :: create_fts_index ( & connection ) . unwrap ( ) ; let handler = super :: handler ( Config { resume_link : Url :: parse ( " " ) . unwrap ( ) , } , vec ! [ ] , pool , ) . unwrap ( ) ; Server { handler , database : tempfile , } }
Creates a handler for the website.
Creates a handler for the website .