use of com.thoughtworks.go.plugin.domain.authorization.Capabilities in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldBuildPluginInfoWithCapablities.
@Test
public void shouldBuildPluginInfoWithCapablities() {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
Capabilities capabilities = new Capabilities(SupportedAuthType.Password, true, true, false);
when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertThat(pluginInfo.getCapabilities(), is(capabilities));
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities in project gocd by gocd.
the class AuthorizationPluginInfoBuilderTest method shouldNotHaveRoleSettingsInPluginInfoIfPluginCannotAuthorize.
@Test
public void shouldNotHaveRoleSettingsInPluginInfoIfPluginCannotAuthorize() {
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin1").build();
Capabilities capabilities = new Capabilities(SupportedAuthType.Password, true, false, false);
when(extension.getCapabilities(descriptor.id())).thenReturn(capabilities);
AuthorizationPluginInfo pluginInfo = new AuthorizationPluginInfoBuilder(extension).pluginInfoFor(descriptor);
assertNull(pluginInfo.getRoleSettings());
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities in project gocd by gocd.
the class PluginInfoMother method createAuthorizationPluginInfoWithoutAbout.
public static AuthorizationPluginInfo createAuthorizationPluginInfoWithoutAbout() {
Capabilities capabilities = new Capabilities(SupportedAuthType.Password, true, true, true);
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id("plugin_id").version("1").pluginJarFileLocation("/home/pluginjar/").isBundledPlugin(true).build();
return new AuthorizationPluginInfo(descriptor, getPluggableSettings(), null, new Image("content_type", "data", "hash"), capabilities);
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities in project gocd by gocd.
the class ConfigInfoProviderTest method pluginInfo.
private AuthorizationPluginInfo pluginInfo(String pluginId, String pluginName) {
final AuthorizationPluginInfo pluginInfo = mock(AuthorizationPluginInfo.class);
final PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
final PluginDescriptor.About about = mock(PluginDescriptor.About.class);
when(pluginDescriptor.id()).thenReturn(pluginId);
when(pluginDescriptor.about()).thenReturn(about);
when(about.name()).thenReturn(pluginName);
when(pluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
Capabilities capabilities = mock(Capabilities.class);
when(capabilities.getSupportedAuthType()).thenReturn(SupportedAuthType.Password);
when(pluginInfo.getCapabilities()).thenReturn(capabilities);
return pluginInfo;
}
use of com.thoughtworks.go.plugin.domain.authorization.Capabilities in project gocd by gocd.
the class SecurityAuthConfigServiceTest method pluginInfo.
private AuthorizationPluginInfo pluginInfo(String githubPluginId, String name, SupportedAuthType supportedAuthType) {
GoPluginDescriptor.About about = GoPluginDescriptor.About.builder().name(name).build();
GoPluginDescriptor descriptor = GoPluginDescriptor.builder().id(githubPluginId).about(about).build();
return new AuthorizationPluginInfo(descriptor, null, null, new Image("svg", "data", "hash"), new Capabilities(supportedAuthType, true, true, false));
}
Aggregations