Commit 17e75815 authored by Leon's avatar Leon Committed by Sietse Ringers

add test for storage removal

parent 6d1b121b
......@@ -362,6 +362,37 @@ func TestUpdatingStorage(t *testing.T) {
}
}
func TestRemoveStorage(t *testing.T) {
client := parseStorage(t)
defer test.ClearTestStorage(t)
bucketsBefore := map[string]bool{"attrs": true, "sigs": true, "userdata": true, "logs": false} // Test storage has no logs
bucketsAfter := map[string]bool{"attrs": false, "sigs": false, "userdata": true, "logs": false} // Userdata should hold a new secret key
old_sk := *(client.secretkey)
// Check that buckets exist
for name, before := range bucketsBefore {
if before {
require.True(t, client.storage.BucketExists([]byte(name)))
}
}
require.NoError(t, client.RemoveStorage())
for name, shouldExist := range bucketsAfter {
if shouldExist {
require.True(t, client.storage.BucketExists([]byte(name)))
} else {
require.False(t, client.storage.BucketExists([]byte(name)))
}
}
// Check that the client has a new secret key
new_sk := *client.secretkey
require.NotEqual(t, old_sk, new_sk)
}
// ------
type TestClientHandler struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment