(t *testing.T)
| 152 | } |
| 153 | |
| 154 | func TestNamespacesList(t *testing.T) { |
| 155 | withTestClient(t, func(config *CmdConfig, tm *tcMocks) { |
| 156 | buf := &bytes.Buffer{} |
| 157 | config.Out = buf |
| 158 | |
| 159 | returnedList := do.NamespaceListResponse{Namespaces: []do.OutputNamespace{ |
| 160 | { |
| 161 | Label: "my_dog", |
| 162 | Namespace: "ns1", |
| 163 | Region: "lon1", |
| 164 | APIHost: "https://lon1.example.com", |
| 165 | }, |
| 166 | { |
| 167 | Label: "something", |
| 168 | Namespace: "ns2", |
| 169 | Region: "sgp1", |
| 170 | APIHost: "https://sgp1.example.com", |
| 171 | }, |
| 172 | }} |
| 173 | expectedOutput := "Label Region Namespace ID API Host\nmy_dog lon1 ns1 https://lon1.example.com\nsomething sgp1 ns2 https://sgp1.example.com\n" |
| 174 | |
| 175 | tm.serverless.EXPECT().ListNamespaces(context.TODO()).Return(returnedList, nil) |
| 176 | |
| 177 | err := RunNamespacesList(config) |
| 178 | |
| 179 | require.NoError(t, err) |
| 180 | assert.Equal(t, expectedOutput, buf.String()) |
| 181 | }) |
| 182 | } |
| 183 | |
| 184 | func TestNamespacesDelete(t *testing.T) { |
| 185 | tests := []struct { |
nothing calls this directly
no test coverage detected