diff options
| author | s <[email protected]> | 2025-11-08 02:44:13 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-08 02:44:13 -0500 |
| commit | dfcf52f30cdbde3a4e1400024b0c27451d179e5d (patch) | |
| tree | cdcac72f0d58b0689777644c771e80d53b502434 /internal/client/client_test.go | |
| parent | 486a369f05125a3b86d663ea94684466e0658099 (diff) | |
| download | dborg-dfcf52f30cdbde3a4e1400024b0c27451d179e5d.tar.gz dborg-dfcf52f30cdbde3a4e1400024b0c27451d179e5d.zip | |
feat: add unauthenticated client support and new osint/x commands
Diffstat (limited to 'internal/client/client_test.go')
| -rw-r--r-- | internal/client/client_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/client/client_test.go b/internal/client/client_test.go index 31939fb..fb21755 100644 --- a/internal/client/client_test.go +++ b/internal/client/client_test.go @@ -44,3 +44,45 @@ func TestNewClient(t *testing.T) { }) } } + +func TestNewUnauthenticatedClient(t *testing.T) { + tests := []struct { + name string + config *config.Config + wantErr bool + }{ + { + name: "config with API key", + config: &config.Config{ + APIKey: "test-key", + BaseURL: "https://db.org.ai", + Timeout: 30 * time.Second, + MaxRetries: 3, + UserAgent: "test-agent", + }, + wantErr: false, + }, + { + name: "config without API key", + config: &config.Config{ + BaseURL: "https://db.org.ai", + Timeout: 30 * time.Second, + MaxRetries: 3, + UserAgent: "test-agent", + }, + wantErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + c, err := NewUnauthenticated(tt.config) + if (err != nil) != tt.wantErr { + t.Errorf("NewUnauthenticated() error = %v, wantErr %v", err, tt.wantErr) + } + if c == nil && !tt.wantErr { + t.Error("NewUnauthenticated() returned nil client") + } + }) + } +} |
