Token creation test correction for Vault 1.0
Token creation with custom ID now raises a warning that causes the Unit test to fail.
This commit is contained in:
parent
2e0d79424f
commit
12083df14b
@ -878,12 +878,18 @@ public class HTTPVaultConnectorTest {
|
||||
try {
|
||||
AuthResponse res = connector.createToken(token);
|
||||
assertThat("No result given.", res, is(notNullValue()));
|
||||
assertThat("Token creation returned warnings.", res.getWarnings(), is(nullValue()));
|
||||
assertThat("Invalid token ID returned.", res.getAuth().getClientToken(), is("test-id"));
|
||||
assertThat("Invalid number of policies returned.", res.getAuth().getPolicies(), hasSize(1));
|
||||
assertThat("Root policy not inherited.", res.getAuth().getPolicies(), contains("root"));
|
||||
assertThat("Metadata unexpected.", res.getAuth().getMetadata(), is(nullValue()));
|
||||
assertThat("Root token should not be renewable", res.getAuth().isRenewable(), is(false));
|
||||
|
||||
// Starting with Vault 1.0 a warning "cusotm ID uses weaker SHA1..." is given.
|
||||
if (VAULT_VERSION.startsWith("1.")) {
|
||||
assertThat("Token creation did not return expected warning.", res.getWarnings(), hasSize(1));
|
||||
} else {
|
||||
assertThat("Token creation returned warnings.", res.getWarnings(), is(nullValue()));
|
||||
}
|
||||
} catch (VaultConnectorException e) {
|
||||
fail("Secret written to inaccessible path.");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user