2021-03-12 12:57:23 +00:00
|
|
|
package accountingtest
|
|
|
|
|
|
|
|
import (
|
2022-12-09 11:16:24 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-api-go/v2/accounting"
|
|
|
|
accountingtest "github.com/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
|
|
|
sessiontest "github.com/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
|
|
|
|
}
|