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

Function usersGetByUsername

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

Source from the content-addressed store, hash-verified

792}
793
794func usersGetByUsername(t *testing.T, ctx context.Context, s *UsersStore) {
795 alice, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})
796 require.NoError(t, err)
797
798 user, err := s.GetByUsername(ctx, alice.Name)
799 require.NoError(t, err)
800 assert.Equal(t, alice.Name, user.Name)
801
802 _, err = s.GetByUsername(ctx, "bad_username")
803 wantErr := ErrUserNotExist{args: errutil.Args{"name": "bad_username"}}
804 assert.Equal(t, wantErr, err)
805}
806
807func usersGetByKeyID(t *testing.T, ctx context.Context, s *UsersStore) {
808 alice, err := s.Create(ctx, "alice", "alice@example.com", CreateUserOptions{})

Callers

nothing calls this directly

Calls 2

GetByUsernameMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected