MCPcopy Create free account
hub / github.com/cli/cli / TestExportSecrets

Function TestExportSecrets

pkg/cmd/secret/list/list_test.go:868–884  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

866}
867
868func TestExportSecrets(t *testing.T) {
869 ios, _, stdout, _ := iostreams.Test()
870 tf, _ := time.Parse(time.RFC3339, "2024-01-01T00:00:00Z")
871 ss := []Secret{{
872 Name: "s1",
873 UpdatedAt: tf,
874 Visibility: shared.All,
875 SelectedReposURL: "https://someurl.com",
876 NumSelectedRepos: 1,
877 }}
878 exporter := cmdutil.NewJSONExporter()
879 exporter.SetFields(secretFields)
880 require.NoError(t, exporter.Write(ios, ss))
881 require.JSONEq(t,
882 `[{"name":"s1","numSelectedRepos":1,"selectedReposURL":"https://someurl.com","updatedAt":"2024-01-01T00:00:00Z","visibility":"all"}]`,
883 stdout.String())
884}

Callers

nothing calls this directly

Calls 5

TestFunction · 0.92
NewJSONExporterFunction · 0.92
SetFieldsMethod · 0.80
WriteMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected