MCPcopy Create free account
hub / github.com/gogs/gogs / usersListFollowings

Function usersListFollowings

internal/database/users_test.go:960–989  ·  view source on GitHub ↗
(t *testing.T, ctx context.Context, s *UsersStore)

Source from the content-addressed store, hash-verified

958}
959
960func usersListFollowings(t *testing.T, ctx context.Context, s *UsersStore) {
961 john, err := s.Create(ctx, "john", "john@example.com", CreateUserOptions{})
962 require.NoError(t, err)
963
964 got, err := s.ListFollowers(ctx, john.ID, 1, 1)
965 require.NoError(t, err)
966 assert.Empty(t, got)
967
968 alice, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
969 require.NoError(t, err)
970 bob, err := s.Create(ctx, "bob", "bob@example.com", CreateUserOptions{})
971 require.NoError(t, err)
972
973 err = s.Follow(ctx, john.ID, alice.ID)
974 require.NoError(t, err)
975 err = s.Follow(ctx, john.ID, bob.ID)
976 require.NoError(t, err)
977
978 // First page only has bob
979 got, err = s.ListFollowings(ctx, john.ID, 1, 1)
980 require.NoError(t, err)
981 require.Len(t, got, 1)
982 assert.Equal(t, bob.ID, got[0].ID)
983
984 // Second page only has alice
985 got, err = s.ListFollowings(ctx, john.ID, 2, 1)
986 require.NoError(t, err)
987 require.Len(t, got, 1)
988 assert.Equal(t, alice.ID, got[0].ID)
989}
990
991func usersSearchByName(t *testing.T, ctx context.Context, s *UsersStore) {
992 alice, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{FullName: "Alice Jordan"})

Callers

nothing calls this directly

Calls 5

ListFollowersMethod · 0.80
FollowMethod · 0.80
ListFollowingsMethod · 0.80
LenMethod · 0.65
CreateMethod · 0.45

Tested by

no test coverage detected