MCPcopy
hub / github.com/spacecloud-io/space-cloud / TestGetProjectID

Function TestGetProjectID

space-cli/cmd/utils/projects_test.go:62–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestGetProjectID(t *testing.T) {
63 tests := []struct {
64 name string
65 setProjectID bool
66 want string
67 want1 bool
68 }{
69 // TODO: Add test cases.
70 {
71 name: "projectID is not set",
72 setProjectID: false,
73 want: "",
74 want1: false,
75 },
76 {
77 name: "projectID is set",
78 setProjectID: true,
79 want: "project1",
80 want1: true,
81 },
82 }
83 for _, tt := range tests {
84 t.Run(tt.name, func(t *testing.T) {
85 if tt.setProjectID {
86 viper.Set("project", "project1")
87 }
88 got, got1 := GetProjectID()
89 if got != tt.want {
90 t.Errorf("GetProjectID() got = %v, want %v", got, tt.want)
91 }
92 if got1 != tt.want1 {
93 t.Errorf("GetProjectID() got1 = %v, want %v", got1, tt.want1)
94 }
95 })
96 }
97}

Callers

nothing calls this directly

Calls 2

GetProjectIDFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected