summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-08-30 11:38:20 +0200
committerJon Bratseth <bratseth@gmail.com>2021-08-30 11:38:20 +0200
commitce42e8fffa6a0bd4e7090ab48d4268ff3e0f476d (patch)
tree14b03d08043eded446378b369ce520e86fb0db24 /client
parent4cf079b62749c2712d2ca5c98b129965810a8050 (diff)
Don't support id attribute
Diffstat (limited to 'client')
-rw-r--r--client/go/cmd/document.go6
-rw-r--r--client/go/cmd/document_test.go7
-rw-r--r--client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Id.json2
-rw-r--r--client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Put.json15
4 files changed, 4 insertions, 26 deletions
diff --git a/client/go/cmd/document.go b/client/go/cmd/document.go
index 38e7cc9bc0e..9f3754873ad 100644
--- a/client/go/cmd/document.go
+++ b/client/go/cmd/document.go
@@ -80,12 +80,10 @@ func post(documentId string, jsonFile string) {
if documentId == "" {
var doc map[string]interface{}
json.Unmarshal(documentData, &doc)
- if doc["id"] != nil {
- documentId = doc["id"].(string)
- } else if doc["put"] != nil {
+ if doc["put"] != nil {
documentId = doc["put"].(string) // document feeder format
} else {
- log.Print("No document id given neither as argument or an 'id' key in the json file")
+ log.Print("No document id given neither as argument or as a 'put' key in the json file")
return
}
}
diff --git a/client/go/cmd/document_test.go b/client/go/cmd/document_test.go
index 27e5d859aa5..e7de8b68ff1 100644
--- a/client/go/cmd/document_test.go
+++ b/client/go/cmd/document_test.go
@@ -29,16 +29,11 @@ func TestDocumentPostWithIdInDocumentShortForm(t *testing.T) {
"id:mynamespace:music::a-head-full-of-dreams", "testdata/A-Head-Full-of-Dreams-With-Id.json", t)
}
-func TestDocumentPostWithIdAsPutInDocument(t *testing.T) {
- assertDocumentPost([]string{"document", "post", "testdata/A-Head-Full-of-Dreams-With-Put.json"},
- "id:mynamespace:music::a-head-full-of-dreams", "testdata/A-Head-Full-of-Dreams-With-Put.json", t)
-}
-
func TestDocumentIdNotSpecified(t *testing.T) {
arguments := []string{"document", "post", "testdata/A-Head-Full-of-Dreams.json"}
client := &mockHttpClient{}
assert.Equal(t,
- "No document id given neither as argument or an 'id' key in the json file\n",
+ "No document id given neither as argument or as a 'put' key in the json file\n",
executeCommand(t, client, arguments, []string{}))
}
diff --git a/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Id.json b/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Id.json
index d39b22782ab..c67b90664d6 100644
--- a/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Id.json
+++ b/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Id.json
@@ -1,5 +1,5 @@
{
- "id": "id:mynamespace:music::a-head-full-of-dreams",
+ "put": "id:mynamespace:music::a-head-full-of-dreams",
"fields": {
"album": "A Head Full of Dreams",
"artist": "Coldplay",
diff --git a/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Put.json b/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Put.json
deleted file mode 100644
index c67b90664d6..00000000000
--- a/client/go/cmd/testdata/A-Head-Full-of-Dreams-With-Put.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "put": "id:mynamespace:music::a-head-full-of-dreams",
- "fields": {
- "album": "A Head Full of Dreams",
- "artist": "Coldplay",
- "year": 2015,
- "category_scores": {
- "cells": [
- { "address" : { "cat" : "pop" }, "value": 1 },
- { "address" : { "cat" : "rock" }, "value": 0.2 },
- { "address" : { "cat" : "jazz" }, "value": 0 }
- ]
- }
- }
-}