2024-04-24 13:00:37 +00:00
|
|
|
package apemanagertest
|
|
|
|
|
|
|
|
import (
|
2024-05-28 08:04:07 +00:00
|
|
|
apetest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/ape/test"
|
2024-04-24 13:00:37 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/apemanager"
|
|
|
|
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session/test"
|
|
|
|
)
|
|
|
|
|
|
|
|
func generateChainID(empty bool) []byte {
|
|
|
|
if empty {
|
|
|
|
return []byte{}
|
|
|
|
}
|
|
|
|
|
|
|
|
return []byte("616c6c6f774f626a476574436e72")
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateAddChainRequestBody(empty bool) *apemanager.AddChainRequestBody {
|
|
|
|
m := new(apemanager.AddChainRequestBody)
|
|
|
|
|
|
|
|
if !empty {
|
2024-05-28 08:04:07 +00:00
|
|
|
m.SetTarget(apetest.GenerateChainTarget(empty))
|
|
|
|
m.SetChain(apetest.GenerateRawChain(empty))
|
2024-04-24 13:00:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateAddChainRequest(empty bool) *apemanager.AddChainRequest {
|
|
|
|
m := new(apemanager.AddChainRequest)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateAddChainRequestBody(empty))
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateAddChainResponseBody(empty bool) *apemanager.AddChainResponseBody {
|
|
|
|
m := new(apemanager.AddChainResponseBody)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetChainID(generateChainID(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateAddChainResponse(empty bool) *apemanager.AddChainResponse {
|
|
|
|
m := new(apemanager.AddChainResponse)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateAddChainResponseBody(empty))
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateRemoveChainRequestBody(empty bool) *apemanager.RemoveChainRequestBody {
|
|
|
|
m := new(apemanager.RemoveChainRequestBody)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetChainID(generateChainID(empty))
|
2024-05-28 08:04:07 +00:00
|
|
|
m.SetTarget(apetest.GenerateChainTarget(empty))
|
2024-04-24 13:00:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateRemoveChainRequest(empty bool) *apemanager.RemoveChainRequest {
|
|
|
|
m := new(apemanager.RemoveChainRequest)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateRemoveChainRequestBody(empty))
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateRemoveChainResponseBody(_ bool) *apemanager.RemoveChainResponseBody {
|
|
|
|
return new(apemanager.RemoveChainResponseBody)
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateRemoveChainResponse(empty bool) *apemanager.RemoveChainResponse {
|
|
|
|
m := new(apemanager.RemoveChainResponse)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateRemoveChainResponseBody(empty))
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateListChainsRequestBody(empty bool) *apemanager.ListChainsRequestBody {
|
|
|
|
m := new(apemanager.ListChainsRequestBody)
|
|
|
|
|
|
|
|
if !empty {
|
2024-05-28 08:04:07 +00:00
|
|
|
m.SetTarget(apetest.GenerateChainTarget(empty))
|
2024-04-24 13:00:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateListChainsRequest(empty bool) *apemanager.ListChainsRequest {
|
|
|
|
m := new(apemanager.ListChainsRequest)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateListChainsRequestBody(empty))
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateListChainsResponseBody(empty bool) *apemanager.ListChainsResponseBody {
|
|
|
|
m := new(apemanager.ListChainsResponseBody)
|
|
|
|
|
|
|
|
if !empty {
|
2024-05-28 08:04:07 +00:00
|
|
|
m.SetChains(apetest.GenerateRawChains(empty, 10))
|
2024-04-24 13:00:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|
|
|
|
|
|
|
|
func GenerateListChainsResponse(empty bool) *apemanager.ListChainsResponse {
|
|
|
|
m := new(apemanager.ListChainsResponse)
|
|
|
|
|
|
|
|
if !empty {
|
|
|
|
m.SetBody(GenerateListChainsResponseBody(empty))
|
|
|
|
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
|
|
|
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
|
|
|
}
|
|
|
|
|
|
|
|
return m
|
|
|
|
}
|