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

Function TestGetTrustDomain

pkg/cmd/attestation/api/client_test.go:320–350  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

318}
319
320func TestGetTrustDomain(t *testing.T) {
321 fetcher := mockMetaGenerator{
322 TrustDomain: "foo",
323 }
324
325 t.Run("with returned trust domain", func(t *testing.T) {
326 c := LiveClient{
327 githubAPI: mockAPIClient{
328 OnREST: fetcher.OnREST,
329 },
330 logger: io.NewTestHandler(),
331 }
332 td, err := c.GetTrustDomain()
333 require.Nil(t, err)
334 require.Equal(t, "foo", td)
335
336 })
337
338 t.Run("with error", func(t *testing.T) {
339 c := LiveClient{
340 githubAPI: mockAPIClient{
341 OnREST: fetcher.OnRESTError,
342 },
343 logger: io.NewTestHandler(),
344 }
345 td, err := c.GetTrustDomain()
346 require.Equal(t, "", td)
347 require.ErrorContains(t, err, "test error")
348 })
349
350}
351
352func TestGetAttestationsRetries(t *testing.T) {
353 getAttestationRetryInterval = 0

Callers

nothing calls this directly

Calls 4

GetTrustDomainMethod · 0.95
NewTestHandlerFunction · 0.92
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…