(t *testing.T)
| 300 | } |
| 301 | |
| 302 | func TestConfig_IsUsingTokenAuth(t *testing.T) { |
| 303 | tests := []struct { |
| 304 | name string |
| 305 | config *Config |
| 306 | expected bool |
| 307 | }{ |
| 308 | { |
| 309 | name: "using token auth", |
| 310 | config: &Config{ |
| 311 | TokenID: "testtoken", |
| 312 | TokenSecret: "testsecret", |
| 313 | }, |
| 314 | expected: true, |
| 315 | }, |
| 316 | { |
| 317 | name: "using password auth", |
| 318 | config: &Config{ |
| 319 | Password: "testpass", |
| 320 | }, |
| 321 | expected: false, |
| 322 | }, |
| 323 | { |
| 324 | name: "incomplete token auth - missing secret", |
| 325 | config: &Config{ |
| 326 | TokenID: "testtoken", |
| 327 | }, |
| 328 | expected: false, |
| 329 | }, |
| 330 | { |
| 331 | name: "incomplete token auth - missing ID", |
| 332 | config: &Config{ |
| 333 | TokenSecret: "testsecret", |
| 334 | }, |
| 335 | expected: false, |
| 336 | }, |
| 337 | { |
| 338 | name: "empty config", |
| 339 | config: &Config{}, |
| 340 | expected: false, |
| 341 | }, |
| 342 | } |
| 343 | |
| 344 | for _, tt := range tests { |
| 345 | t.Run(tt.name, func(t *testing.T) { |
| 346 | result := tt.config.IsUsingTokenAuth() |
| 347 | assert.Equal(t, tt.expected, result) |
| 348 | }) |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | func TestConfig_GetAPIToken(t *testing.T) { |
| 353 | config := &Config{ |
nothing calls this directly
no test coverage detected