Skip to content

Commit 403e1fb

Browse files
committed
Fix test
1 parent f0fed90 commit 403e1fb

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

internal/db/organizations_test.go

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@ func orgsCountByUser(t *testing.T, ctx context.Context, db *organizations) {
324324
assert.Equal(t, int64(0), got)
325325
}
326326

327-
func orgsCount(t *testing.T, db *organizations) {
328-
ctx := context.Background()
329-
327+
func orgsCount(t *testing.T, ctx context.Context, db *organizations) {
330328
// Has no organization initially
331329
got := db.Count(ctx)
332330
assert.Equal(t, int64(0), got)
@@ -344,9 +342,7 @@ func orgsCount(t *testing.T, db *organizations) {
344342
assert.Equal(t, int64(1), got)
345343
}
346344

347-
func orgsDeleteByID(t *testing.T, db *organizations) {
348-
ctx := context.Background()
349-
345+
func orgsDeleteByID(t *testing.T, ctx context.Context, db *organizations) {
350346
tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsDeleteByID-tempPictureAvatarUploadPath")
351347
conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath})
352348

@@ -407,9 +403,7 @@ func orgsDeleteByID(t *testing.T, db *organizations) {
407403
assert.Equal(t, wantErr, err)
408404
}
409405

410-
func orgsAddMember(t *testing.T, db *organizations) {
411-
ctx := context.Background()
412-
406+
func orgsAddMember(t *testing.T, ctx context.Context, db *organizations) {
413407
usersStore := NewUsersStore(db.DB)
414408
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
415409
require.NoError(t, err)
@@ -446,9 +440,7 @@ func orgsAddMember(t *testing.T, db *organizations) {
446440
assert.Equal(t, 2, gotOrg.NumMembers)
447441
}
448442

449-
func orgsRemoveMember(t *testing.T, db *organizations) {
450-
ctx := context.Background()
451-
443+
func orgsRemoveMember(t *testing.T, ctx context.Context, db *organizations) {
452444
usersStore := NewUsersStore(db.DB)
453445
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
454446
require.NoError(t, err)
@@ -560,9 +552,7 @@ func orgsRemoveMember(t *testing.T, db *organizations) {
560552
assert.Equal(t, 1, gotOrg.NumMembers)
561553
}
562554

563-
func orgsHasMember(t *testing.T, db *organizations) {
564-
ctx := context.Background()
565-
555+
func orgsHasMember(t *testing.T, ctx context.Context, db *organizations) {
566556
got, _ := db.HasMember(ctx, 1, 1)
567557
assert.False(t, got)
568558

@@ -573,9 +563,7 @@ func orgsHasMember(t *testing.T, db *organizations) {
573563
assert.True(t, got)
574564
}
575565

576-
func orgsListMembers(t *testing.T, db *organizations) {
577-
ctx := context.Background()
578-
566+
func orgsListMembers(t *testing.T, ctx context.Context, db *organizations) {
579567
usersStore := NewUsersStore(db.DB)
580568
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
581569
require.NoError(t, err)
@@ -602,9 +590,7 @@ func orgsListMembers(t *testing.T, db *organizations) {
602590
assert.Equal(t, bob.ID, got[1].ID)
603591
}
604592

605-
func orgsIsOwnedBy(t *testing.T, db *organizations) {
606-
ctx := context.Background()
607-
593+
func orgsIsOwnedBy(t *testing.T, ctx context.Context, db *organizations) {
608594
usersStore := NewUsersStore(db.DB)
609595
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
610596
require.NoError(t, err)
@@ -629,9 +615,7 @@ func orgsIsOwnedBy(t *testing.T, db *organizations) {
629615
assert.False(t, got)
630616
}
631617

632-
func orgsSetMemberVisibility(t *testing.T, db *organizations) {
633-
ctx := context.Background()
634-
618+
func orgsSetMemberVisibility(t *testing.T, ctx context.Context, db *organizations) {
635619
usersStore := NewUsersStore(db.DB)
636620
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
637621
require.NoError(t, err)
@@ -653,9 +637,7 @@ func orgsSetMemberVisibility(t *testing.T, db *organizations) {
653637
assert.Len(t, got, 1)
654638
}
655639

656-
func orgsGetTeamByName(t *testing.T, db *organizations) {
657-
ctx := context.Background()
658-
640+
func orgsGetTeamByName(t *testing.T, ctx context.Context, db *organizations) {
659641
usersStore := NewUsersStore(db.DB)
660642
alice, err := usersStore.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
661643
require.NoError(t, err)
@@ -695,10 +677,10 @@ func orgsGetTeamByName(t *testing.T, db *organizations) {
695677
require.NoError(t, err)
696678
}
697679

698-
func orgsAccessibleRepositoriesByUser(t *testing.T, db *organizations) {
680+
func orgsAccessibleRepositoriesByUser(t *testing.T, ctx context.Context, db *organizations) {
699681
// todo
700682
}
701683

702-
func orgsMirrorRepositoriesByUser(t *testing.T, db *organizations) {
684+
func orgsMirrorRepositoriesByUser(t *testing.T, ctx context.Context, db *organizations) {
703685
// todo
704686
}

internal/db/repositories_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,6 @@ func reposListWatches(t *testing.T, ctx context.Context, db *repositories) {
320320
}
321321

322322
func reposWatch(t *testing.T, ctx context.Context, db *repositories) {
323-
repo1, err := db.Create(ctx, 1, CreateRepoOptions{Name: "repo1"})
324-
require.NoError(t, err)
325-
326323
t.Run("user does not have access to the repository", func(t *testing.T) {
327324
repo1, err := db.Create(ctx, 1, CreateRepoOptions{Name: "repo1", Private: true})
328325
require.NoError(t, err)

0 commit comments

Comments
 (0)