Search in sources :

Example 1 with AuthorizationMessageConverterV1

use of com.thoughtworks.go.plugin.access.authorization.AuthorizationMessageConverterV1 in project gocd by gocd.

the class AuthorizationRequestProcessorTest method shouldProcessInvalidateCacheRequest.

@Test
public void shouldProcessInvalidateCacheRequest() throws Exception {
    PluginRoleService pluginRoleService = mock(PluginRoleService.class);
    when(authorizationExtension.getMessageConverter(AuthorizationMessageConverterV1.VERSION)).thenReturn(new AuthorizationMessageConverterV1());
    GoApiRequest request = new DefaultGoApiRequest(INVALIDATE_CACHE_REQUEST.requestName(), "1.0", null);
    AuthorizationRequestProcessor authorizationRequestProcessor = new AuthorizationRequestProcessor(registry, null, authorizationExtension, pluginRoleService);
    GoApiResponse response = authorizationRequestProcessor.process(pluginDescriptor, request);
    assertThat(response.responseCode(), is(200));
    verify(pluginRoleService).invalidateRolesFor("cd.go.authorization.github");
}
Also used : GoApiResponse(com.thoughtworks.go.plugin.api.response.GoApiResponse) AuthorizationMessageConverterV1(com.thoughtworks.go.plugin.access.authorization.AuthorizationMessageConverterV1) DefaultGoApiRequest(com.thoughtworks.go.plugin.api.request.DefaultGoApiRequest) GoApiRequest(com.thoughtworks.go.plugin.api.request.GoApiRequest) PluginRoleService(com.thoughtworks.go.server.service.PluginRoleService) DefaultGoApiRequest(com.thoughtworks.go.plugin.api.request.DefaultGoApiRequest) Test(org.junit.Test)

Aggregations

AuthorizationMessageConverterV1 (com.thoughtworks.go.plugin.access.authorization.AuthorizationMessageConverterV1)1 DefaultGoApiRequest (com.thoughtworks.go.plugin.api.request.DefaultGoApiRequest)1 GoApiRequest (com.thoughtworks.go.plugin.api.request.GoApiRequest)1 GoApiResponse (com.thoughtworks.go.plugin.api.response.GoApiResponse)1 PluginRoleService (com.thoughtworks.go.server.service.PluginRoleService)1 Test (org.junit.Test)1