go/internal/bugseti/ghcheck_test.go
Snider 2979816d83 feat(bugseti): migrate from GitHub gh CLI to Forgejo SDK
Replace all exec.Command("gh", ...) calls with the existing pkg/forge
wrapper around the Forgejo Go SDK. BugSETI no longer requires the gh
CLI to be installed.

Changes:
- fetcher: use forge.ListIssues/GetIssue instead of gh issue list/view
- submit: use forge.ForkRepo/CreatePullRequest instead of gh pr create
- seeder: use git clone with forge URL + token auth instead of gh clone
- ghcheck: CheckForge() returns *forge.Client via forge.NewFromConfig()
- config: add ForgeURL/ForgeToken fields (GitHubToken kept for migration)
- pkg/forge: add Token(), GetCurrentUser(), ForkRepo(), CreatePullRequest(),
  ListIssueComments(), and label filtering to ListIssuesOpts

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-13 20:55:39 +00:00

23 lines
511 B
Go

package bugseti
import (
"os"
"testing"
)
func TestCheckForge_Bad_MissingConfig(t *testing.T) {
// Clear any env-based forge config to ensure CheckForge fails
t.Setenv("FORGE_TOKEN", "")
t.Setenv("FORGE_URL", "")
// Point HOME to a temp dir so no config file is found
t.Setenv("HOME", t.TempDir())
if xdg := os.Getenv("XDG_CONFIG_HOME"); xdg != "" {
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
}
_, err := CheckForge()
if err == nil {
t.Fatal("expected error when forge is not configured")
}
}