MCPcopy Index your code
hub / github.com/google/go-github / TestWithAuthToken

Function TestWithAuthToken

github/github_test.go:610–637  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

608}
609
610func TestWithAuthToken(t *testing.T) {
611 t.Parallel()
612
613 t.Run("empty_token", func(t *testing.T) {
614 t.Parallel()
615
616 opts := clientOptions{}
617 err := WithAuthToken("")(&opts)
618 if err == nil || err.Error() != "token must not be empty" {
619 t.Error("expected error for empty token, got nil")
620 }
621 })
622
623 t.Run("valid_token", func(t *testing.T) {
624 t.Parallel()
625
626 validToken := "ghp_exampletoken1234567890"
627 opts := clientOptions{}
628 err := WithAuthToken(validToken)(&opts)
629 if err != nil {
630 t.Fatalf("WithAuthToken errored: %v", err)
631 }
632
633 if opts.token == nil || *opts.token != validToken {
634 t.Errorf("token = %v, want %v", opts.token, validToken)
635 }
636 })
637}
638
639func TestWithURLs(t *testing.T) {
640 t.Parallel()

Callers

nothing calls this directly

Calls 3

WithAuthTokenFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…