Search in sources :

Example 1 with SQLiteMemoryDatabaseConfig

use of com.searchcode.app.config.SQLiteMemoryDatabaseConfig in project searchcode-server by boyter.

the class ApiRouteServiceTest method testRepoListApiEnabledNoAuth.

public void testRepoListApiEnabledNoAuth() {
    Request mockRequest = Mockito.mock(Request.class);
    Repo repo = new Repo(new SQLiteMemoryDatabaseConfig(), new Helpers());
    repo.createTableIfMissing();
    ApiRouteService apiRouteService = new ApiRouteService(null, null, repo, null, null);
    apiRouteService.apiEnabled = true;
    apiRouteService.apiAuth = false;
    RepoResultApiResponse apiResponse = apiRouteService.repoList(mockRequest, null);
    assertThat(apiResponse.getMessage()).isEmpty();
    assertThat(apiResponse.getRepoResultList()).hasSize(0);
    assertThat(apiResponse.isSucessful()).isTrue();
}
Also used : Repo(com.searchcode.app.dao.Repo) ApiRouteService(com.searchcode.app.service.route.ApiRouteService) Helpers(com.searchcode.app.util.Helpers) Request(spark.Request) SQLiteMemoryDatabaseConfig(com.searchcode.app.config.SQLiteMemoryDatabaseConfig) RepoResultApiResponse(com.searchcode.app.dto.api.RepoResultApiResponse)

Aggregations

SQLiteMemoryDatabaseConfig (com.searchcode.app.config.SQLiteMemoryDatabaseConfig)1 Repo (com.searchcode.app.dao.Repo)1 RepoResultApiResponse (com.searchcode.app.dto.api.RepoResultApiResponse)1 ApiRouteService (com.searchcode.app.service.route.ApiRouteService)1 Helpers (com.searchcode.app.util.Helpers)1 Request (spark.Request)1