use of org.cloudfoundry.credhub.credential.UserCredentialValue in project credhub by cloudfoundry-incubator.
the class UserGeneratorTest method generateCredential_givenAUsernameAndPasswordParameters_generatesUserWithUsernameAndGeneratedPassword.
@Test
public void generateCredential_givenAUsernameAndPasswordParameters_generatesUserWithUsernameAndGeneratedPassword() {
passwordParameters.setUsername("test-user");
final UserCredentialValue user = subject.generateCredential(passwordParameters);
assertThat(user.getUsername(), equalTo("test-user"));
assertThat(user.getPassword(), equalTo("fake-generated-password"));
assertThat(user.getSalt(), equalTo("fake-generated-salt"));
}
use of org.cloudfoundry.credhub.credential.UserCredentialValue in project credhub by cloudfoundry-incubator.
the class CredentialFactoryTest method makeCredentialFromRequest_givenUserType_andNoExisting_returnsUserCredential.
@Test
public void makeCredentialFromRequest_givenUserType_andNoExisting_returnsUserCredential() throws Exception {
UserCredentialValue userValue = new UserCredentialValue("username", PLAINTEXT_VALUE, "salt");
UserCredentialVersion credential = (UserCredentialVersion) subject.makeNewCredentialVersion(CredentialType.valueOf("user"), CREDENTIAL_NAME, userValue, null, generationParameters);
MatcherAssert.assertThat(credential.getCredential().getName(), equalTo(CREDENTIAL_NAME));
assertThat(credential.getUsername(), equalTo("username"));
assertThat(credential.getPassword(), equalTo(PLAINTEXT_VALUE));
assertThat(credential.getSalt(), equalTo("salt"));
}
Aggregations