MCPcopy Index your code
hub / github.com/cli/cli / TestGetOrgAndRepo

Function TestGetOrgAndRepo

pkg/cmd/attestation/inspect/bundle_test.go:12–36  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestGetOrgAndRepo(t *testing.T) {
13 t.Run("with valid source URL", func(t *testing.T) {
14 sourceURL := "https://github.com/github/gh-attestation"
15 org, repo, err := getOrgAndRepo("", sourceURL)
16 require.Nil(t, err)
17 require.Equal(t, "github", org)
18 require.Equal(t, "gh-attestation", repo)
19 })
20
21 t.Run("with invalid source URL", func(t *testing.T) {
22 sourceURL := "hub.com/github/gh-attestation"
23 org, repo, err := getOrgAndRepo("", sourceURL)
24 require.Error(t, err)
25 require.Zero(t, org)
26 require.Zero(t, repo)
27 })
28
29 t.Run("with valid source tenant URL", func(t *testing.T) {
30 sourceURL := "https://foo.ghe.com/github/gh-attestation"
31 org, repo, err := getOrgAndRepo("foo", sourceURL)
32 require.Nil(t, err)
33 require.Equal(t, "github", org)
34 require.Equal(t, "gh-attestation", repo)
35 })
36}
37
38func TestGetAttestationDetail(t *testing.T) {
39 bundlePath := test.NormalizeRelativePath("../test/data/sigstore-js-2.1.0-bundle.json")

Callers

nothing calls this directly

Calls 4

getOrgAndRepoFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…