-
This unit test will update document with no existing Index:
PUT
call to the endpoint/es/notExistIndexCreate/_create/1111
with indexData in body.- indexData is in json form and defined in init.go file.
- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK and document is updated in new Index.
-
This unit test will update document with existing Index:
PUT
call to the endpoint/es/"+indexName+"/_create/1111
with indexData in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK.
-
This unit test will update document with existing Index and not existing ID:
PUT
call to the endpoint/es/"+indexName+"/_create/notexistCreate
with indexData in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK.
-
This unit test will update document with existing Index and existing ID:
PUT
call to the endpoint/es/"+indexName+"/_create/1111
with indexData in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusOK (i.e 200),that means test is OK.
-
This unit test will update document with error Input:
PUT
call to the endpoint/es/"+indexName+"/_create/1111
withxxx
in body.- Send a request to the server and response would be recorded.
- Using assert.Equal will test if the response code is equal to http.StatusBadRequest (i.e 400),that means test is OK.