MCPcopy Index your code
hub / github.com/gogs/gogs / usersList

Function usersList

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

Source from the content-addressed store, hash-verified

894}
895
896func usersList(t *testing.T, ctx context.Context, s *UsersStore) {
897 alice, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
898 require.NoError(t, err)
899 bob, err := s.Create(ctx, "bob", "bob@example.com", CreateUserOptions{})
900 require.NoError(t, err)
901
902 // Create an organization shouldn't count
903 // TODO: Use Orgs.Create to replace SQL hack when the method is available.
904 org1, err := s.Create(ctx, "org1", "org1@example.com", CreateUserOptions{})
905 require.NoError(t, err)
906 err = s.db.Exec(
907 dbutil.Quote("UPDATE %s SET type = ? WHERE id = ?", "user"),
908 UserTypeOrganization, org1.ID,
909 ).Error
910 require.NoError(t, err)
911
912 got, err := s.List(ctx, 1, 1)
913 require.NoError(t, err)
914 require.Len(t, got, 1)
915 assert.Equal(t, alice.ID, got[0].ID)
916
917 got, err = s.List(ctx, 2, 1)
918 require.NoError(t, err)
919 require.Len(t, got, 1)
920 assert.Equal(t, bob.ID, got[0].ID)
921
922 got, err = s.List(ctx, 1, 3)
923 require.NoError(t, err)
924 require.Len(t, got, 2)
925 assert.Equal(t, alice.ID, got[0].ID)
926 assert.Equal(t, bob.ID, got[1].ID)
927}
928
929func usersListFollowers(t *testing.T, ctx context.Context, s *UsersStore) {
930 john, err := s.Create(ctx, "john", "john@example.com", CreateUserOptions{})

Callers

nothing calls this directly

Calls 5

QuoteFunction · 0.92
ExecMethod · 0.80
ListMethod · 0.65
LenMethod · 0.65
CreateMethod · 0.45

Tested by

no test coverage detected