Search in sources :

Example 1 with YesBasicAuthFilter

use of org.icij.datashare.session.YesBasicAuthFilter in project datashare by ICIJ.

the class ProjectResourceTest method test_delete_project_with_unauthorized_user.

@Test
public void test_delete_project_with_unauthorized_user() {
    configure(routes -> routes.add(new ProjectResource(repository, indexer)).filter(new YesBasicAuthFilter(new PropertiesProvider())));
    when(repository.deleteAll("projectId")).thenReturn(true);
    delete("/api/project/hacker-datashare").withPreemptiveAuthentication("hacker", "pass").should().respond(401);
    delete("/api/project/projectId").should().respond(401);
}
Also used : PropertiesProvider(org.icij.datashare.PropertiesProvider) YesBasicAuthFilter(org.icij.datashare.session.YesBasicAuthFilter) AbstractProdWebServerTest(org.icij.datashare.web.testhelpers.AbstractProdWebServerTest) Test(org.junit.Test)

Aggregations

PropertiesProvider (org.icij.datashare.PropertiesProvider)1 YesBasicAuthFilter (org.icij.datashare.session.YesBasicAuthFilter)1 AbstractProdWebServerTest (org.icij.datashare.web.testhelpers.AbstractProdWebServerTest)1 Test (org.junit.Test)1