use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldNotUsePasswordForEquality.
@Test
public void shouldNotUsePasswordForEquality() {
SvnMaterial svnBoozer = new SvnMaterial("foo.com", "loser", "boozer", true);
SvnMaterial svnZooser = new SvnMaterial("foo.com", "loser", "zooser", true);
assertThat(svnBoozer.hashCode(), is(svnZooser.hashCode()));
assertThat(svnBoozer, is(svnZooser));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldGetLongDescriptionForMaterial.
@Test
public void shouldGetLongDescriptionForMaterial() {
SvnMaterial material = new SvnMaterial("http://url/", "user", "password", true, "folder");
assertThat(material.getLongDescription(), is("URL: http://url/, Username: user, CheckExternals: true"));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldErrorOutIfDecryptionFails.
@Test
public void shouldErrorOutIfDecryptionFails() throws InvalidCipherTextException {
GoCipher mockGoCipher = mock(GoCipher.class);
String fakeCipherText = "fake cipher text";
when(mockGoCipher.decrypt(fakeCipherText)).thenThrow(new InvalidCipherTextException("exception"));
SvnMaterial material = new SvnMaterial("/foo", "username", null, false, mockGoCipher);
ReflectionUtil.setField(material, "encryptedPassword", fakeCipherText);
try {
material.getPassword();
fail("Should have thrown up");
} catch (Exception e) {
assertThat(e.getMessage(), is("Could not decrypt the password to get the real password"));
}
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldReturnEqualsEvenIfPasswordsAreDifferent.
@Test
public void shouldReturnEqualsEvenIfPasswordsAreDifferent() throws Exception {
SvnMaterial material = MaterialsMother.svnMaterial();
material.setPassword("password");
SvnMaterial other = MaterialsMother.svnMaterial();
other.setPassword("password1");
assertThat(material, is(other));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldGetAttributesWithoutSecureFields.
@Test
public void shouldGetAttributesWithoutSecureFields() {
SvnMaterial material = new SvnMaterial("http://username:password@svnrepo.com", "user", "password", true);
Map<String, Object> attributes = material.getAttributes(false);
assertThat(attributes.get("type"), is("svn"));
Map<String, Object> configuration = (Map<String, Object>) attributes.get("svn-configuration");
assertThat(configuration.get("url"), is("http://username:******@svnrepo.com"));
assertThat(configuration.get("username"), is("user"));
assertThat(configuration.get("password"), is(nullValue()));
assertThat(configuration.get("check-externals"), is(true));
}
Aggregations