tests fix all tests

This commit is contained in:
Xiang Li
2013-12-05 17:48:32 -05:00
parent 4ba7d85d56
commit b556252358
6 changed files with 74 additions and 69 deletions

View File

@@ -24,7 +24,7 @@ func TestV2CreateUnique(t *testing.T) {
node := body["node"].(map[string]interface{})
assert.Equal(t, node["key"], "/foo/bar/2", "")
assert.Equal(t, node["dir"], true, "")
assert.Nil(t, node["dir"], "")
assert.Equal(t, node["modifiedIndex"], 2, "")
// Second POST should add next index to list.

View File

@@ -126,12 +126,13 @@ func TestV2UpdateKeySuccess(t *testing.T) {
// Ensures that a key is not conditionally set if it previously did not exist.
//
// $ curl -X PUT localhost:4001/v2/keys/foo?dir=true
// $ curl -X PUT localhost:4001/v2/keys/foo/bar -d value=XXX -d prevExist=true
//
func TestV2UpdateKeyFailOnValue(t *testing.T) {
tests.RunServer(func(s *server.Server) {
v := url.Values{}
resp, _ := tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo"), v)
resp, _ := tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo?dir=true"), v)
v.Set("value", "YYY")
v.Set("prevExist", "true")