Skip to content
Snippets Groups Projects
Commit 60207767 authored by Jonah Husson's avatar Jonah Husson
Browse files

Add basic json test, fix tags in loadJson

parent 9afeb516
No related branches found
No related tags found
3 merge requests!231Revert "Update store to print changes to the partners list",!187Xx 3829/triggers,!181Xx 3818/jsonbackup
......@@ -21,7 +21,7 @@ func storeJson(json string, kv *versioned.KV) error {
}
func loadJson(kv *versioned.KV) string {
obj, err := kv.Get(passwordStorageKey, passwordStorageVersion)
obj, err := kv.Get(jsonStorageKey, jsonStorageVersion)
if err != nil {
return ""
}
......
package backup
import (
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/ekv"
"testing"
)
func Test_storeJson_loadJson(t *testing.T) {
kv := versioned.NewKV(make(ekv.Memstore))
json := "{'data': {'one': 1}}"
err := storeJson(json, kv)
if err != nil {
t.Errorf("Failed to store JSON: %+v", err)
}
loaded := loadJson(kv)
if loaded != json {
t.Errorf("Did not receive expected data from KV.\n\tExpected: %s, Received: %s\n", json, loaded)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment