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

Function usersCount

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

Source from the content-addressed store, hash-verified

357}
358
359func usersCount(t *testing.T, ctx context.Context, s *UsersStore) {
360 // Has no user initially
361 got := s.Count(ctx)
362 assert.Equal(t, int64(0), got)
363
364 _, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
365 require.NoError(t, err)
366 got = s.Count(ctx)
367 assert.Equal(t, int64(1), got)
368
369 // Create an organization shouldn't count
370 // TODO: Use Orgs.Create to replace SQL hack when the method is available.
371 org1, err := s.Create(ctx, "org1", "org1@example.com", CreateUserOptions{})
372 require.NoError(t, err)
373 err = s.db.Exec(
374 dbutil.Quote("UPDATE %s SET type = ? WHERE id = ?", "user"),
375 UserTypeOrganization, org1.ID,
376 ).Error
377 require.NoError(t, err)
378 got = s.Count(ctx)
379 assert.Equal(t, int64(1), got)
380}
381
382func usersCreate(t *testing.T, ctx context.Context, s *UsersStore) {
383 alice, err := s.Create(

Callers

nothing calls this directly

Calls 4

QuoteFunction · 0.92
ExecMethod · 0.80
CountMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected