All checks were successful
* Add plugin option for protogen in Makefile * Fix the generator for the plugin in util/protogen * Erase convertable types, move helpful methods to gRPC protobufs * Erase helpers for convertations * Generate StableMarshlal/StableSize for protobufs by the protoc plugin Signed-off-by: Airat Arifullin a.arifullin@yadro.com
63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
package accountingtest
|
|
|
|
import (
|
|
accounting "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting/grpc"
|
|
accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
|
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test"
|
|
)
|
|
|
|
func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest {
|
|
m := new(accounting.BalanceRequest)
|
|
|
|
if !empty {
|
|
m.SetBody(GenerateBalanceRequestBody(false))
|
|
}
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
|
m.SetVerifyHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequest_Body {
|
|
m := new(accounting.BalanceRequest_Body)
|
|
|
|
if !empty {
|
|
m.SetOwnerId(accountingtest.GenerateOwnerID(false))
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateBalanceResponse(empty bool) *accounting.BalanceResponse {
|
|
m := new(accounting.BalanceResponse)
|
|
|
|
if !empty {
|
|
m.SetBody(GenerateBalanceResponseBody(false))
|
|
}
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
|
m.SetVerifyHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateBalanceResponseBody(empty bool) *accounting.BalanceResponse_Body {
|
|
m := new(accounting.BalanceResponse_Body)
|
|
|
|
if !empty {
|
|
m.SetBalance(GenerateDecimal(false))
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateDecimal(empty bool) *accounting.Decimal {
|
|
m := new(accounting.Decimal)
|
|
if !empty {
|
|
m.SetValue(1)
|
|
m.SetPrecision(2)
|
|
}
|
|
|
|
return m
|
|
}
|