// Copyright 2025 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT package secrets import ( "testing" ) func TestGetSecretSourceArgs(t *testing.T) { tests := []struct { name string args []string wantErr bool }{ { name: "valid args", args: []string{"VALID_SECRET", "secret_value"}, wantErr: false, }, { name: "missing name", args: []string{}, wantErr: true, }, { name: "too many args", args: []string{"SECRET_NAME", "value", "extra"}, wantErr: true, }, { name: "invalid secret name", args: []string{"invalid_secret", "value"}, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { // Test argument validation only if len(tt.args) == 0 { if !tt.wantErr { t.Error("Expected error for empty args") } return } if len(tt.args) > 2 { if !tt.wantErr { t.Error("Expected error for too many args") } return } }) } }