func TestSaveShared(t *testing.T) { defer storage.DeleteAllData(enum.SHARED) info := CreateMockShared() // Local SaveSharedLocal(info) encoded, _ := storage.GetLocalData(enum.SHARED) decoded := Shared{} json.Unmarshal(encoded, &decoded) assert.Equal(t, info, decoded) // Cluster SaveSharedCluster(info) encoded, _ = storage.GetLocalData(enum.SHARED) decoded = Shared{} json.Unmarshal(encoded, &decoded) assert.Equal(t, info, decoded) }
func TestSaveAnalytics(t *testing.T) { defer storage.DeleteAllData(enum.ANALYTICS) analytics := CreateMockAnalytics() SaveAnalytics(analytics) encoded, _ := storage.GetLocalData(enum.ANALYTICS) decoded := GruAnalytics{} json.Unmarshal(encoded, &decoded) assert.Equal(t, analytics, decoded) }
func TestSavePolicy(t *testing.T) { defer storage.DeleteAllData(enum.POLICIES) policy := CreateRandomMockPolicies(1)[0] SavePolicy(policy) encoded, _ := storage.GetLocalData(enum.POLICIES) decoded := Policy{} json.Unmarshal(encoded, &decoded) assert.Equal(t, policy, decoded) }
func TestSaveStats(t *testing.T) { defer storage.DeleteAllData(enum.STATS) stats := CreateMockStats() SaveStats(stats) encoded, _ := storage.GetLocalData(enum.STATS) decoded := GruStats{} json.Unmarshal(encoded, &decoded) assert.Equal(t, stats, decoded) }