Skip to content

Commit

Permalink
remove comment out tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiling-J authored and Rader committed Dec 10, 2024
1 parent 8421cd9 commit 483fdb1
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions component/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"opencsg.com/csghub-server/builder/git/gitserver"
"opencsg.com/csghub-server/builder/git/membership"
"opencsg.com/csghub-server/builder/git/mirrorserver"
"opencsg.com/csghub-server/builder/rpc"
"opencsg.com/csghub-server/builder/store/database"
"opencsg.com/csghub-server/common/tests"
"opencsg.com/csghub-server/common/types"
Expand Down Expand Up @@ -196,30 +197,30 @@ func TestRepoComponent_DeleteRepo(t *testing.T) {

}

// func TestRepoComponent_PublicToUser(t *testing.T) {
// ctx := context.TODO()
// repo := initializeTestRepoComponent(ctx, t)

// repo.mocks.userSvcClient.EXPECT().GetUserInfo(ctx, "user", "user").Return(&rpc.User{
// ID: 1,
// Roles: []string{"a", "b"},
// Orgs: []rpc.Organization{
// {UserID: 2},
// {UserID: 3},
// },
// }, nil)

// filter := &types.RepoFilter{}
// mrepos := []*database.Repository{
// {Name: "foo"},
// }
// repo.mocks.stores.RepoMock().EXPECT().PublicToUser(ctx, types.ModelRepo, []int64{1, 2, 3}, filter, 10, 1, false).Return(mrepos, 100, nil)

// repos, count, err := repo.PublicToUser(ctx, types.ModelRepo, "user", &types.RepoFilter{}, 10, 1)
// require.Equal(t, mrepos, repos)
// require.Equal(t, 100, count)
// require.Nil(t, err)
// }
func TestRepoComponent_PublicToUser(t *testing.T) {
ctx := context.TODO()
repo := initializeTestRepoComponent(ctx, t)

repo.mocks.userSvcClient.EXPECT().GetUserInfo(ctx, "user", "user").Return(&rpc.User{
ID: 1,
Roles: []string{"a", "b"},
Orgs: []rpc.Organization{
{UserID: 2},
{UserID: 3},
},
}, nil)

filter := &types.RepoFilter{}
mrepos := []*database.Repository{
{Name: "foo"},
}
repo.mocks.stores.RepoMock().EXPECT().PublicToUser(ctx, types.ModelRepo, []int64{1, 2, 3}, filter, 10, 1, false).Return(mrepos, 100, nil)

repos, count, err := repo.PublicToUser(ctx, types.ModelRepo, "user", &types.RepoFilter{}, 10, 1)
require.Equal(t, mrepos, repos)
require.Equal(t, 100, count)
require.Nil(t, err)
}

func mockUserRepoAdminPermission(ctx context.Context, stores *tests.MockStores, userName string) {
stores.UserMock().EXPECT().FindByUsername(ctx, userName).Return(database.User{
Expand Down

0 comments on commit 483fdb1

Please sign in to comment.