use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnTrueWhenBasicAuthWithOnlyUsernameIsProvidedInURL.
@Test
public void shouldReturnTrueWhenBasicAuthWithOnlyUsernameIsProvidedInURL() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url.git", new GitMaterial("http://user@repo-url.git"));
assertThat(isEqual, is(true));
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnEmptyListIfParamIsMissingForRepoURL.
@Test
public void shouldReturnEmptyListIfParamIsMissingForRepoURL() throws Exception {
GitMaterial material1 = mock(GitMaterial.class);
when(material1.getUrlArgument()).thenReturn(new UrlArgument("https://machine.local.git"));
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
Set<Material> actual = implementer.prune(materials, new HashMap());
assertThat(actual.size(), is(0));
verifyNoMoreInteractions(material1);
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnFalseWhenNoValidatorCouldParseUrl.
@Test
public void shouldReturnFalseWhenNoValidatorCouldParseUrl() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url.git", new GitMaterial("something.completely.random"));
assertThat(isEqual, is(false));
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnTrueWhenBasicAuthIsProvidedInURL.
@Test
public void shouldReturnTrueWhenBasicAuthIsProvidedInURL() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url.git", new GitMaterial("http://user:passW)rD@repo-url.git"));
assertThat(isEqual, is(true));
}
use of com.thoughtworks.go.config.materials.git.GitMaterial in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnFalseWhenProtocolIsDifferent.
@Test
public void shouldReturnFalseWhenProtocolIsDifferent() throws Exception {
boolean isEqual = implementer.isUrlEqual("http://repo-url.git", new GitMaterial("https://repo-url.git"));
assertThat(isEqual, is(false));
}
Aggregations