finish testing client/cache

This commit is contained in:
Daniel Smith
2014-08-03 15:36:36 -07:00
parent 03fe91cc4a
commit 041d56f3d0
9 changed files with 227 additions and 31 deletions

View File

@@ -23,6 +23,7 @@ import (
func TestGenericJSONBase(t *testing.T) {
j := JSONBase{
ID: "foo",
APIVersion: "a",
Kind: "b",
ResourceVersion: 1,
@@ -31,8 +32,11 @@ func TestGenericJSONBase(t *testing.T) {
if err != nil {
t.Fatalf("new err: %v", err)
}
// Proove g supports JSONBaseInterface.
// Prove g supports JSONBaseInterface.
jbi := JSONBaseInterface(g)
if e, a := "foo", jbi.ID(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "a", jbi.APIVersion(); e != a {
t.Errorf("expected %v, got %v", e, a)
}
@@ -43,10 +47,15 @@ func TestGenericJSONBase(t *testing.T) {
t.Errorf("expected %v, got %v", e, a)
}
jbi.SetID("bar")
jbi.SetAPIVersion("c")
jbi.SetKind("d")
jbi.SetResourceVersion(2)
// Prove that jbi changes the original object.
if e, a := "bar", j.ID; e != a {
t.Errorf("expected %v, got %v", e, a)
}
if e, a := "c", j.APIVersion; e != a {
t.Errorf("expected %v, got %v", e, a)
}