Skip to content

Commit

Permalink
is: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaplots committed Oct 21, 2024
1 parent 3349f9a commit a887621
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 9 deletions.
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/api_key_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ func (st *StoreTest) TestAPIKeyStorePagination(t *T) {

got, err := s.FindAPIKeys(paginateCtx, app1.GetEntityIdentifiers())
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e.Name, should.Equal, all[i+2*int(page-1)].Name)
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/application_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ func (st *StoreTest) TestApplicationStorePagination(t *T) {

got, err := s.FindApplications(paginateCtx, nil, mask)
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, all[i+2*int(page-1)])
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/client_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ func (st *StoreTest) TestClientStorePagination(t *T) {

got, err := s.FindClients(paginateCtx, nil, mask)
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, all[i+2*int(page-1)])
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/invitation_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,11 @@ func (st *StoreTest) TestInvitationStorePagination(t *T) {

got, err := s.FindInvitations(paginateCtx)
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, all[i+2*int(page-1)])
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/identityserver/storetest/membership_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (st *StoreTest) TestMembershipStorePagination(t *T) {
}
}

a.So(total, should.Equal, 102)
a.So(total, should.Equal, 7)
}
})
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/oauth_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,11 @@ func (st *StoreTest) TestOAuthStorePagination(t *T) {

got, err := s.ListAccessTokens(paginateCtx, usr1.GetIds(), clients[0].GetIds())
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, accessTokens[i+2*int(page-1)])
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/organization_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ func (st *StoreTest) TestOrganizationStorePagination(t *T) {

got, err := s.FindOrganizations(paginateCtx, nil, mask)
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, all[i+2*int(page-1)])
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/user_session_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ func (st *StoreTest) TestUserSessionStorePagination(t *T) {

got, err := s.FindSessions(paginateCtx, usr1.GetIds())
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, sessions[i+2*int(page-1)])
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/identityserver/storetest/user_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ func (st *StoreTest) TestUserStorePagination(t *T) {

got, err := s.FindUsers(paginateCtx, nil, mask)
if a.So(err, should.BeNil) && a.So(got, should.NotBeNil) {
a.So(got, should.HaveLength, 2)
if page == 4 {
a.So(got, should.HaveLength, 1)
} else {
a.So(got, should.HaveLength, 2)
}
for i, e := range got {
a.So(e, should.Resemble, all[i+2*int(page-1)])
}
Expand Down

0 comments on commit a887621

Please sign in to comment.