mirror of https://github.com/gogs/gogs.git
Fix test
parent
f0fed90a0a
commit
403e1fb219
|
@ -324,9 +324,7 @@ func orgsCountByUser(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
assert.Equal(t, int64(0), got)
|
assert.Equal(t, int64(0), got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsCount(t *testing.T, db *organizations) {
|
func orgsCount(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
// Has no organization initially
|
// Has no organization initially
|
||||||
got := db.Count(ctx)
|
got := db.Count(ctx)
|
||||||
assert.Equal(t, int64(0), got)
|
assert.Equal(t, int64(0), got)
|
||||||
|
@ -344,9 +342,7 @@ func orgsCount(t *testing.T, db *organizations) {
|
||||||
assert.Equal(t, int64(1), got)
|
assert.Equal(t, int64(1), got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsDeleteByID(t *testing.T, db *organizations) {
|
func orgsDeleteByID(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsDeleteByID-tempPictureAvatarUploadPath")
|
tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsDeleteByID-tempPictureAvatarUploadPath")
|
||||||
conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath})
|
conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath})
|
||||||
|
|
||||||
|
@ -407,9 +403,7 @@ func orgsDeleteByID(t *testing.T, db *organizations) {
|
||||||
assert.Equal(t, wantErr, err)
|
assert.Equal(t, wantErr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsAddMember(t *testing.T, db *organizations) {
|
func orgsAddMember(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
usersStore := NewUsersStore(db.DB)
|
usersStore := NewUsersStore(db.DB)
|
||||||
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -446,9 +440,7 @@ func orgsAddMember(t *testing.T, db *organizations) {
|
||||||
assert.Equal(t, 2, gotOrg.NumMembers)
|
assert.Equal(t, 2, gotOrg.NumMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsRemoveMember(t *testing.T, db *organizations) {
|
func orgsRemoveMember(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
usersStore := NewUsersStore(db.DB)
|
usersStore := NewUsersStore(db.DB)
|
||||||
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -560,9 +552,7 @@ func orgsRemoveMember(t *testing.T, db *organizations) {
|
||||||
assert.Equal(t, 1, gotOrg.NumMembers)
|
assert.Equal(t, 1, gotOrg.NumMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsHasMember(t *testing.T, db *organizations) {
|
func orgsHasMember(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
got, _ := db.HasMember(ctx, 1, 1)
|
got, _ := db.HasMember(ctx, 1, 1)
|
||||||
assert.False(t, got)
|
assert.False(t, got)
|
||||||
|
|
||||||
|
@ -573,9 +563,7 @@ func orgsHasMember(t *testing.T, db *organizations) {
|
||||||
assert.True(t, got)
|
assert.True(t, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsListMembers(t *testing.T, db *organizations) {
|
func orgsListMembers(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
usersStore := NewUsersStore(db.DB)
|
usersStore := NewUsersStore(db.DB)
|
||||||
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -602,9 +590,7 @@ func orgsListMembers(t *testing.T, db *organizations) {
|
||||||
assert.Equal(t, bob.ID, got[1].ID)
|
assert.Equal(t, bob.ID, got[1].ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsIsOwnedBy(t *testing.T, db *organizations) {
|
func orgsIsOwnedBy(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
usersStore := NewUsersStore(db.DB)
|
usersStore := NewUsersStore(db.DB)
|
||||||
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -629,9 +615,7 @@ func orgsIsOwnedBy(t *testing.T, db *organizations) {
|
||||||
assert.False(t, got)
|
assert.False(t, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsSetMemberVisibility(t *testing.T, db *organizations) {
|
func orgsSetMemberVisibility(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
usersStore := NewUsersStore(db.DB)
|
usersStore := NewUsersStore(db.DB)
|
||||||
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -653,9 +637,7 @@ func orgsSetMemberVisibility(t *testing.T, db *organizations) {
|
||||||
assert.Len(t, got, 1)
|
assert.Len(t, got, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsGetTeamByName(t *testing.T, db *organizations) {
|
func orgsGetTeamByName(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
usersStore := NewUsersStore(db.DB)
|
usersStore := NewUsersStore(db.DB)
|
||||||
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -695,10 +677,10 @@ func orgsGetTeamByName(t *testing.T, db *organizations) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsAccessibleRepositoriesByUser(t *testing.T, db *organizations) {
|
func orgsAccessibleRepositoriesByUser(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
|
||||||
func orgsMirrorRepositoriesByUser(t *testing.T, db *organizations) {
|
func orgsMirrorRepositoriesByUser(t *testing.T, ctx context.Context, db *organizations) {
|
||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,9 +320,6 @@ func reposListWatches(t *testing.T, ctx context.Context, db *repositories) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func reposWatch(t *testing.T, ctx context.Context, db *repositories) {
|
func reposWatch(t *testing.T, ctx context.Context, db *repositories) {
|
||||||
repo1, err := db.Create(ctx, 1, CreateRepoOptions{Name: "repo1"})
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
t.Run("user does not have access to the repository", func(t *testing.T) {
|
t.Run("user does not have access to the repository", func(t *testing.T) {
|
||||||
repo1, err := db.Create(ctx, 1, CreateRepoOptions{Name: "repo1", Private: true})
|
repo1, err := db.Create(ctx, 1, CreateRepoOptions{Name: "repo1", Private: true})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
Loading…
Reference in New Issue