pub fn empty(self) -> (TestApp, MockAnonymousUser) {
        use crate::git;

        let (app, middle) = crate::build_app(self.config, self.proxy);

        let runner = if self.build_job_runner {
            let connection_pool = app.primary_database.clone();
            let repository_config = RepositoryConfig {
                index_location: Url::from_file_path(&git::bare()).unwrap(),
                credentials: Credentials::Missing,
            };
            let index = WorkerRepository::open(&repository_config).expect("Could not clone index");
            let environment = Environment::new(
                index,
                connection_pool.clone(),
                app.config.uploader.clone(),
                app.http_client().clone(),
            );

            Some(
                Runner::builder(connection_pool, environment)
                    // We only have 1 connection in tests, so trying to run more than
                    // 1 job concurrently will just block
                    .thread_count(1)
                    .job_start_timeout(Duration::from_secs(5))
                    .build(),
            )
        } else {
            None
        };

        let test_app_inner = TestAppInner {
            app,
            _bomb: self.bomb,
            middle,
            index: self.index,
            runner,
        };
        let test_app = TestApp(Rc::new(test_app_inner));
        let anon = MockAnonymousUser {
            app: test_app.clone(),
        };
        (test_app, anon)
    }
/// Create a `TestApp` with an empty database
Create a `TestApp` with an empty database
Create a ` TestApp ` with an empty database
pub fn empty(self) -> (TestApp, MockAnonymousUser) {
        use crate::git;
        let (app, middle) = crate::build_app(self.config, self.proxy);
        let runner = if self.build_job_runner {
            let connection_pool = app.primary_database.clone();
            let repository_config = RepositoryConfig {
                index_location: Url::from_file_path(&git::bare()).unwrap(),
                credentials: Credentials::Missing,
            };
            let index = WorkerRepository::open(&repository_config).expect("Could not clone index");
            let environment = Environment::new(
                index,
                connection_pool.clone(),
                app.config.uploader.clone(),
                app.http_client().clone(),
            );
            Some(
                Runner::builder(connection_pool, environment)
                    // We only have 1 connection in tests, so trying to run more than
                    // 1 job concurrently will just block
                    .thread_count(1)
                    .job_start_timeout(Duration::from_secs(5))
                    .build(),
            )
        } else {
            None
        };
        let test_app_inner = TestAppInner {
            app,
            _bomb: self.bomb,
            middle,
            index: self.index,
            runner,
        };
        let test_app = TestApp(Rc::new(test_app_inner));
        let anon = MockAnonymousUser {
            app: test_app.clone(),
        };
        (test_app, anon)
    }
pub fn empty ( self ) -> ( TestApp , MockAnonymousUser ) { use crate :: git ; let ( app , middle ) = crate :: build_app ( self . config , self . proxy ) ; let runner = if self . build_job_runner { let connection_pool = app . primary_database . clone ( ) ; let repository_config = RepositoryConfig { index_location : Url :: from_file_path ( & git :: bare ( ) ) . unwrap ( ) , credentials : Credentials :: Missing , } ; let index = WorkerRepository :: open ( & repository_config ) . expect ( " " ) ; let environment = Environment :: new ( index , connection_pool . clone ( ) , app . config . uploader . clone ( ) , app . http_client ( ) . clone ( ) , ) ; Some ( Runner :: builder ( connection_pool , environment ) // We only have 1 connection in tests, so trying to run more than // 1 job concurrently will just block . thread_count ( 1 ) . job_start_timeout ( Duration :: from_secs ( 5 ) ) . build ( ) , ) } else { None } ; let test_app_inner = TestAppInner { app , _bomb : self . bomb , middle , index : self . index , runner , } ; let test_app = TestApp ( Rc :: new ( test_app_inner ) ) ; let anon = MockAnonymousUser { app : test_app . clone ( ) , } ; ( test_app , anon ) }
Create a `TestApp` with an empty database
Create a ` TestApp ` with an empty database
self