{"modulePath":"github.com/vidyesh95/Go-Tutorial","version":"v0.0.0-20261123112932-610d9af314ca","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubtest\n\nPackage githubtest is a minimal fake of GitHub's OAuth and REST endpoints for tests. It is a real HTTP server (httptest), so the production client code (auth.GitHub) runs unchanged; only its three base URLs are redirected here. It also VERIFIES PKCE, so a test fails if the client forgets to send the challenge or the verifier.\n\nEndpoints: GET /login/oauth/authorize, POST /login/oauth/access\\_token, GET /api/user, GET /api/user/emails.\n\n## Constants\n\n```go\nconst (\n\tClientID     = \"test-client-id\"\n\tClientSecret = \"test-client-secret\"\n)\n```\n\n## Types\n\n```go\ntype Email struct {\n\tEmail    string `json:\"email\"`\n\tPrimary  bool   `json:\"primary\"`\n\tVerified bool   `json:\"verified\"`\n}\n```\nEmail is one entry of GET /user/emails.\n\n```go\ntype Server struct {\n\t*httptest.Server\n\t// contains filtered or unexported fields\n}\n```\nServer is the fake. Change User (via SetUser) between flows to simulate different people.\n\n```go\nfunc New(tb testing.TB) *Server\n```\nNew starts the fake and stops it when the test ends.\n\n```go\nfunc (s *Server) Config(redirectURL string) auth.GitHubConfig\n```\nConfig returns an auth.GitHubConfig whose URLs point at the fake.\n\n```go\nfunc (s *Server) SetUser(u User)\n```\nSetUser sets the account the fake reports from now on.\n\n```go\ntype User struct {\n\tID        int64\n\tLogin     string\n\tName      string\n\tAvatarURL string\n\tEmails    []Email\n}\n```\nUser is the GitHub account the fake will report.\n\n","path":"github.com/vidyesh95/Go-Tutorial/05-projects/taskapi/internal/auth/githubtest","name":"githubtest","synopsis":"Package githubtest is a minimal fake of GitHub's OAuth and REST endpoints for tests.","isRedistributable":true}
