init
This commit is contained in:
@@ -44,6 +44,31 @@ func TestListOrgSkillsFiltersReposWithoutSkillMD(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListOrgSkillsNormalizesLoopbackCloneURLToConfiguredBaseURL(t *testing.T) {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/api/v1/orgs/skills/repos", func(w http.ResponseWriter, r *http.Request) {
|
||||
_ = json.NewEncoder(w).Encode([]apiRepo{
|
||||
{Name: "good", FullName: "skills/good", CloneURL: "http://localhost:3000/skills/good.git", DefaultBranch: "main"},
|
||||
})
|
||||
})
|
||||
mux.HandleFunc("/api/v1/repos/skills/good/contents/SKILL.md", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
server := httptest.NewServer(mux)
|
||||
defer server.Close()
|
||||
|
||||
client := NewClient(server.URL, Auth{Type: AuthPassword, Username: "alice", Secret: "secret"})
|
||||
repos, err := client.ListOrgSkills(context.Background(), "skills")
|
||||
if err != nil {
|
||||
t.Fatalf("ListOrgSkills returned error: %v", err)
|
||||
}
|
||||
|
||||
want := server.URL + "/skills/good.git"
|
||||
if repos[0].CloneURL != want {
|
||||
t.Fatalf("CloneURL = %q, want %q", repos[0].CloneURL, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListOrgSkillsUsesTokenAuth(t *testing.T) {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/api/v1/orgs/skills/repos", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user