MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestConfig_IsUsingTokenAuth

Function TestConfig_IsUsingTokenAuth

internal/config/config_test.go:302–350  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

300}
301
302func 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
352func TestConfig_GetAPIToken(t *testing.T) {
353 config := &Config{

Callers

nothing calls this directly

Calls 2

RunMethod · 0.80
IsUsingTokenAuthMethod · 0.65

Tested by

no test coverage detected