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");
}
Aggregations