64 lines
1.4 KiB
Go
64 lines
1.4 KiB
Go
package accountingtest
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/accounting"
|
|
accountingtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs/test"
|
|
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session/test"
|
|
)
|
|
|
|
func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest {
|
|
m := new(accounting.BalanceRequest)
|
|
|
|
if !empty {
|
|
m.SetBody(GenerateBalanceRequestBody(false))
|
|
}
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequestBody {
|
|
m := new(accounting.BalanceRequestBody)
|
|
|
|
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.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
|
|
|
return m
|
|
}
|
|
|
|
func GenerateBalanceResponseBody(empty bool) *accounting.BalanceResponseBody {
|
|
m := new(accounting.BalanceResponseBody)
|
|
|
|
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
|
|
}
|