[#94] object: Generate protobufs for Patch method

* Generate protobufs for patch method;
* Create marshalers, unmarshalers, converters for gererated types;
* Add unit-tests.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-07-24 17:40:47 +03:00 committed by Evgenii Stratonikov
parent 3dfa2f4fd6
commit 9b90d139c5
9 changed files with 1341 additions and 245 deletions

View file

@ -691,6 +691,63 @@ func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse {
return m
}
func GeneratePatchRequestBodyPatch(empty bool) *object.PatchRequestBodyPatch {
m := new(object.PatchRequestBodyPatch)
if !empty {
m.Range = GenerateRange(false)
m.Chunk = []byte("GeneratePatchRequestBodyPatch")
}
return m
}
func GeneratePatchRequestBody(empty bool) *object.PatchRequestBody {
m := new(object.PatchRequestBody)
if !empty {
m.Address = refstest.GenerateAddress(empty)
m.NewAttributes = GenerateAttributes(empty)
m.ReplaceAttributes = false
m.Patch = GeneratePatchRequestBodyPatch(empty)
}
return m
}
func GeneratePatchRequest(empty bool) *object.PatchRequest {
m := new(object.PatchRequest)
if !empty {
m.Body = GeneratePatchRequestBody(empty)
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GeneratePatchResponseBody(empty bool) *object.PatchResponseBody {
m := new(object.PatchResponseBody)
if !empty {
m.ObjectID = refstest.GenerateObjectID(empty)
}
return m
}
func GeneratePatchResponse(empty bool) *object.PatchResponse {
m := new(object.PatchResponse)
if !empty {
m.Body = GeneratePatchResponseBody(empty)
}
return m
}
func randomInt(n int) int {
return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n)
}