MCPcopy Create free account
hub / github.com/compozy/agh / TestClientFetchRequestedReleaseByTag

Function TestClientFetchRequestedReleaseByTag

internal/registry/github/client_test.go:637–665  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

635}
636
637func TestClientFetchRequestedReleaseByTag(t *testing.T) {
638 t.Parallel()
639
640 server := newGitHubServer(t, func(writer http.ResponseWriter, request *http.Request) {
641 switch request.URL.Path {
642 case "/repos/acme/demo/releases/tags/v1.2.3":
643 writeJSON(
644 writer,
645 `{"tag_name":"v1.2.3","draft":false,"prerelease":false,"tarball_url":"`+serverURLPlaceholder+`/downloads/source.tar.gz","assets":[]}`,
646 )
647 default:
648 http.NotFound(writer, request)
649 }
650 })
651 defer server.Close()
652
653 client := NewClient(server.URL)
654 release, err := client.fetchRequestedRelease(
655 context.Background(),
656 repoSlug{owner: "acme", name: "demo", full: "acme/demo"},
657 "v1.2.3",
658 )
659 if err != nil {
660 t.Fatalf("fetchRequestedRelease() error = %v", err)
661 }
662 if release.TagName != "v1.2.3" {
663 t.Fatalf("fetchRequestedRelease() tag = %q, want v1.2.3", release.TagName)
664 }
665}
666
667func TestClientFetchRequestedReleaseNotFound(t *testing.T) {
668 t.Parallel()

Callers

nothing calls this directly

Calls 5

fetchRequestedReleaseMethod · 0.95
newGitHubServerFunction · 0.85
writeJSONFunction · 0.70
NewClientFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected