143 lines
3.6 KiB
Go
143 lines
3.6 KiB
Go
package apemanagertest
|
|
|
|
import (
|
|
apetest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/ape/test"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/apemanager"
|
|
sessiontest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/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 {
|
|
m.SetTarget(apetest.GenerateChainTarget(empty))
|
|
m.SetChain(apetest.GenerateRawChain(empty))
|
|
}
|
|
|
|
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))
|
|
m.SetTarget(apetest.GenerateChainTarget(empty))
|
|
}
|
|
|
|
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 {
|
|
m.SetTarget(apetest.GenerateChainTarget(empty))
|
|
}
|
|
|
|
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 {
|
|
m.SetChains(apetest.GenerateRawChains(empty, 10))
|
|
}
|
|
|
|
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
|
|
}
|