Polishing

Add tests for write and delete.

Closes gh-503
Closes gh-511
This commit is contained in:
Mark Paluch
2019-12-02 09:14:48 +01:00
parent a73a00f23e
commit 1d99ad9679
2 changed files with 29 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ import reactor.test.StepVerifier;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.vault.VaultException;
import org.springframework.vault.domain.Person;
import org.springframework.vault.support.ObjectMapperSupplier;
import org.springframework.vault.util.IntegrationTestSupport;
@@ -129,6 +130,13 @@ class ReactiveVaultTemplateGenericIntegrationTests extends IntegrationTestSuppor
}).verifyComplete();
}
@Test
void listShouldNotReturnAbsentKey() {
vaultOperations.list("foo").collectList().as(StepVerifier::create)
.consumeNextWith(actual -> assertThat(actual).isEmpty()).verifyComplete();
}
@Test
void listShouldReturnExistingKey() {
@@ -167,4 +175,18 @@ class ReactiveVaultTemplateGenericIntegrationTests extends IntegrationTestSuppor
}).verifyComplete();
}
@Test
void deleteUnknownPathShouldFail() {
vaultOperations.delete("foobar").as(StepVerifier::create)
.verifyError(VaultException.class);
}
@Test
void writeUnknownPathShouldFail() {
vaultOperations.write("foobar").as(StepVerifier::create)
.verifyError(VaultException.class);
}
}

View File

@@ -126,6 +126,13 @@ class VaultTemplateGenericIntegrationTests extends IntegrationTestSupport {
assertThat(keys).contains("mykey");
}
@Test
void listShouldNotReturnAbsentKey() {
List<String> keys = vaultOperations.list("foo");
assertThat(keys).isEmpty();
}
@Test
void deleteShouldRemoveKey() {