MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_ValidateCopilotPAT

Function TestSpec_PublicAPI_ValidateCopilotPAT

pkg/stringutil/spec_test.go:715–735  ·  view source on GitHub ↗

TestSpec_PublicAPI_ValidateCopilotPAT validates the documented behavior of ValidateCopilotPAT as described in the package README.md. Specification: "Returns nil if the token is a fine-grained PAT; returns an actionable error message with a link to create the correct token type otherwise."

(t *testing.T)

Source from the content-addressed store, hash-verified

713// Specification: "Returns nil if the token is a fine-grained PAT; returns an
714// actionable error message with a link to create the correct token type otherwise."
715func TestSpec_PublicAPI_ValidateCopilotPAT(t *testing.T) {
716 t.Run("fine-grained PAT returns nil", func(t *testing.T) {
717 err := ValidateCopilotPAT("github_pat_validtokenhere")
718 assert.NoError(t, err,
719 "ValidateCopilotPAT should return nil for fine-grained PAT")
720 })
721
722 t.Run("classic PAT returns actionable error", func(t *testing.T) {
723 err := ValidateCopilotPAT("ghp_classic_token")
724 require.Error(t, err,
725 "ValidateCopilotPAT should return an error for classic PAT")
726 assert.NotEmpty(t, err.Error(),
727 "ValidateCopilotPAT error should contain an actionable message")
728 })
729
730 t.Run("oauth token returns actionable error", func(t *testing.T) {
731 err := ValidateCopilotPAT("gho_oauth_token")
732 require.Error(t, err,
733 "ValidateCopilotPAT should return an error for OAuth token")
734 })
735}
736
737// TestSpec_PublicAPI_GetPATTypeDescription validates the documented behavior of
738// GetPATTypeDescription as described in the package README.md.

Callers

nothing calls this directly

Calls 3

ValidateCopilotPATFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected