use of com.thoughtworks.go.domain.SecureSiteUrl in project gocd by gocd.
the class WebBasedPluginAuthenticationProviderTest method shouldGetAuthorizationServerUrlWithConfiguredSecureSiteUrl.
@Test
void shouldGetAuthorizationServerUrlWithConfiguredSecureSiteUrl() {
final ServerConfig serverConfig = mock(ServerConfig.class);
when(goConfigService.serverConfig()).thenReturn(serverConfig);
when(serverConfig.hasAnyUrlConfigured()).thenReturn(true);
when(serverConfig.getSiteUrlPreferablySecured()).thenReturn(new SecureSiteUrl("https://foo.bar.com"));
authenticationProvider.getAuthorizationServerUrl(PLUGIN_ID, "https://example.com");
verify(authorizationExtension, never()).getAuthorizationServerUrl(PLUGIN_ID, singletonList(githubSecurityAuthconfig), "https://example.com");
verify(authorizationExtension).getAuthorizationServerUrl(PLUGIN_ID, singletonList(githubSecurityAuthconfig), "https://foo.bar.com");
}
use of com.thoughtworks.go.domain.SecureSiteUrl in project gocd by gocd.
the class ArtifactsDiskSpaceFullCheckerTest method configWithSiteUrl.
private static CruiseConfig configWithSiteUrl() {
ServerConfig serverConfig = new ServerConfig(null, null, new SiteUrl("http://test.host"), new SecureSiteUrl("https://test.host"));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(serverConfig);
return cruiseConfig;
}
use of com.thoughtworks.go.domain.SecureSiteUrl in project gocd by gocd.
the class DiskSpaceFullCheckerTest method shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl.
@Test
public void shouldFormatLowDiskSpaceWarningMailWithHelpLinksHttpAndSiteUrl() throws URISyntaxException {
String expectedHelpUrl = docsUrl("/installation/configuring_server_details.html");
ServerConfig serverConfig = new ServerConfig(null, null, new SiteUrl("http://test.host"), new SecureSiteUrl("https://test.host"));
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setServerConfig(serverConfig);
GoConfigService goConfigService = mock(GoConfigService.class);
when(goConfigService.artifactsDir()).thenReturn(null);
when(goConfigService.currentCruiseConfig()).thenReturn(cruiseConfig);
when(goConfigService.adminEmail()).thenReturn("admin@email.com");
ArtifactsDiskSpaceFullChecker diskSpaceFullChecker = new ArtifactsDiskSpaceFullChecker(new SystemEnvironment(), null, goConfigService, null) {
@Override
protected String targetFolderCanonicalPath() {
return "";
}
};
SendEmailMessage actual = diskSpaceFullChecker.createEmail();
assertThat(actual.getBody(), Matchers.containsString(expectedHelpUrl));
}
use of com.thoughtworks.go.domain.SecureSiteUrl in project gocd by gocd.
the class ServerConfigTest method shouldIgnoreErrorsFieldOnEquals.
@Test
public void shouldIgnoreErrorsFieldOnEquals() throws Exception {
ServerConfig one = new ServerConfig(new SecurityConfig(), new MailHost(new GoCipher()), new SiteUrl("siteURL"), new SecureSiteUrl("secureURL"));
one.addError("siteUrl", "I dont like this url");
assertThat(one, is(new ServerConfig(new SecurityConfig(), new MailHost(new GoCipher()), new SiteUrl("siteURL"), new SecureSiteUrl("secureURL"))));
}
use of com.thoughtworks.go.domain.SecureSiteUrl in project gocd by gocd.
the class ServerConfigTest method shouldReturnAnEmptyForSecureSiteUrlIfOnlySiteUrlIsConfigured.
@Test
public void shouldReturnAnEmptyForSecureSiteUrlIfOnlySiteUrlIsConfigured() throws Exception {
ServerConfig serverConfig = new ServerConfig(null, null, new SiteUrl("http://foo.bar:813"), new SecureSiteUrl());
assertThat(serverConfig.getHttpsUrl(), is(new SecureSiteUrl()));
}
Aggregations