浏览代码

client: test httpKeysAPI's Create and Update methods

Brian Waldon 11 年之前
父节点
当前提交
943c7ef307
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      client/keys_test.go

+ 28 - 0
client/keys_test.go

@@ -1151,3 +1151,31 @@ func TestHTTPKeysAPIDeleteResponse(t *testing.T) {
 		t.Errorf("incorrect Response: want=%#v got=%#v", wantResponse, resp)
 	}
 }
+
+func TestHTTPKeysAPICreateAction(t *testing.T) {
+	act := &setAction{
+		Key:       "/foo",
+		Value:     "bar",
+		PrevExist: PrevNoExist,
+		PrevIndex: 0,
+		PrevValue: "",
+		TTL:       0,
+	}
+
+	kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}}
+	kAPI.Create(context.Background(), "/foo", "bar")
+}
+
+func TestHTTPKeysAPIUpdateAction(t *testing.T) {
+	act := &setAction{
+		Key:       "/foo",
+		Value:     "bar",
+		PrevExist: PrevExist,
+		PrevIndex: 0,
+		PrevValue: "",
+		TTL:       0,
+	}
+
+	kAPI := httpKeysAPI{client: &actionAssertingHTTPClient{t: t, act: act}}
+	kAPI.Update(context.Background(), "/foo", "bar")
+}