fix: x/group pagination from CLI (#14923)

This commit is contained in:
atheeshp
2023-02-06 13:56:00 +00:00
committed by GitHub
parent 5e57be076e
commit fd7bbd7e8d
2 changed files with 138 additions and 2 deletions
+123 -1
View File
@@ -117,9 +117,24 @@ func (s *E2ETestSuite) TestQueryGroupsByMembers() {
0,
[]*group.GroupInfo{},
},
{
"expect one group (request with pagination)",
[]string{
members.Members[0].Member.Address,
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=1",
},
false,
"",
1,
groups.Groups,
},
{
"expect one group",
[]string{members.Members[0].Member.Address, fmt.Sprintf("--%s=json", flags.FlagOutput)},
[]string{
members.Members[0].Member.Address,
fmt.Sprintf("--%s=json", flags.FlagOutput),
},
false,
"",
1,
@@ -233,6 +248,27 @@ func (s *E2ETestSuite) TestQueryGroupMembers() {
},
},
},
{
"members found (request with pagination)",
[]string{
strconv.FormatUint(s.group.Id, 10),
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=1",
},
false,
"",
0,
[]*group.GroupMember{
{
GroupId: s.group.Id,
Member: &group.Member{
Address: val.Address.String(),
Weight: "3",
Metadata: validMetadata,
},
},
},
},
}
for _, tc := range testCases {
@@ -299,6 +335,20 @@ func (s *E2ETestSuite) TestQueryGroupsByAdmin() {
s.group,
},
},
{
"found groups (request with pagination)",
[]string{
val.Address.String(),
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=2",
},
false,
"",
0,
[]*group.GroupInfo{
s.group,
},
},
}
for _, tc := range testCases {
@@ -427,6 +477,21 @@ func (s *E2ETestSuite) TestQueryGroupPoliciesByGroup() {
s.groupPolicies[5],
},
},
{
"found group policies (request with pagination)",
[]string{
strconv.FormatUint(s.group.Id, 10),
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=2",
},
false,
"",
0,
[]*group.GroupPolicyInfo{
s.groupPolicies[0],
s.groupPolicies[1],
},
},
}
for _, tc := range testCases {
@@ -503,6 +568,21 @@ func (s *E2ETestSuite) TestQueryGroupPoliciesByAdmin() {
s.groupPolicies[5],
},
},
{
"found group policies (request with pagination)",
[]string{
val.Address.String(),
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=2",
},
false,
"",
0,
[]*group.GroupPolicyInfo{
s.groupPolicies[0],
s.groupPolicies[1],
},
},
}
for _, tc := range testCases {
@@ -617,6 +697,20 @@ func (s *E2ETestSuite) TestQueryProposalsByGroupPolicy() {
s.proposal,
},
},
{
"found proposals (request with pagination)",
[]string{
s.groupPolicies[0].Address,
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=2",
},
false,
"",
0,
[]*group.Proposal{
s.proposal,
},
},
}
for _, tc := range testCases {
@@ -723,6 +817,20 @@ func (s *E2ETestSuite) TestQueryVotesByProposal() {
s.vote,
},
},
{
"found votes (request with pagination)",
[]string{
"1",
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=2",
},
false,
"",
0,
[]*group.Vote{
s.vote,
},
},
}
for _, tc := range testCases {
@@ -786,6 +894,20 @@ func (s *E2ETestSuite) TestQueryVotesByVoter() {
s.vote,
},
},
{
"found votes (request with pagination)",
[]string{
val.Address.String(),
fmt.Sprintf("--%s=json", flags.FlagOutput),
"--limit=2",
},
false,
"",
0,
[]*group.Vote{
s.vote,
},
},
}
for _, tc := range testCases {