Add existence check verification to config/client testcase

This commit is contained in:
vishalnayak 2016-04-06 20:59:05 -04:00
parent b954f6d9b0
commit 727a66b378

View File

@ -81,6 +81,21 @@ func TestBackend_ConfigClient(t *testing.T) {
},
})
checkFound, exists, err := b.HandleExistenceCheck(&logical.Request{
Operation: logical.CreateOperation,
Path: "config/client",
Storage: storage,
})
if err != nil {
t.Fatal(err)
}
if !checkFound {
t.Fatal("existence check not found for path 'config/client'")
}
if exists {
t.Fatal("existence check should have return 'false' for 'config/client'")
}
configClientCreateRequest := &logical.Request{
Operation: logical.UpdateOperation,
Path: "config/client",
@ -92,6 +107,21 @@ func TestBackend_ConfigClient(t *testing.T) {
t.Fatal(err)
}
checkFound, exists, err = b.HandleExistenceCheck(&logical.Request{
Operation: logical.CreateOperation,
Path: "config/client",
Storage: storage,
})
if err != nil {
t.Fatal(err)
}
if !checkFound {
t.Fatal("existence check not found for path 'config/client'")
}
if !exists {
t.Fatal("existence check should have return 'true' for 'config/client'")
}
clientConfig, err := clientConfigEntry(storage)
if err != nil {
t.Fatal(err)
@ -103,6 +133,9 @@ func TestBackend_ConfigClient(t *testing.T) {
}
}
func TestBackend_PathConfigCertificate(t *testing.T) {
}
func TestBackend_PathImage(t *testing.T) {
config := logical.TestBackendConfig()
storage := &logical.InmemStorage{}