2021-03-12 12:57:23 +00:00
|
|
|
package accountingtest
|
|
|
|
|
|
|
|
import (
|
2023-03-07 10:38:56 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/accounting"
|
|
|
|
accountingtest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
|
|
|
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test"
|
2021-03-12 12:57:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func GenerateBalanceRequest(empty bool) *accounting.BalanceRequest {
|
|
|
|
m := new(accounting.BalanceRequest)
|
|
|
|
|
2021-06-11 11:53:07 +00:00
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateBalanceRequestBody(false))
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateBalanceRequestBody(empty bool) *accounting.BalanceRequestBody {
|
|
|
|
m := new(accounting.BalanceRequestBody)
|
|
|
|
|
2021-06-11 11:53:07 +00:00
|
|
|
if !empty {
|
|
|
|
m.SetOwnerID(accountingtest.GenerateOwnerID(false))
|
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateBalanceResponse(empty bool) *accounting.BalanceResponse {
|
|
|
|
m := new(accounting.BalanceResponse)
|
|
|
|
|
2021-06-11 11:53:07 +00:00
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateBalanceResponseBody(false))
|
|
|
|
}
|
|
|
|
|
2021-03-12 12:57:23 +00:00
|
|
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateBalanceResponseBody(empty bool) *accounting.BalanceResponseBody {
|
|
|
|
m := new(accounting.BalanceResponseBody)
|
|
|
|
|
2021-06-11 11:53:07 +00:00
|
|
|
if !empty {
|
|
|
|
m.SetBalance(GenerateDecimal(false))
|
|
|
|
}
|
2021-03-12 12:57:23 +00:00
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateDecimal(empty bool) *accounting.Decimal {
|
|
|
|
m := new(accounting.Decimal)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetValue(1)
|
|
|
|
m.SetPrecision(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|