(t *testing.T)
| 597 | } |
| 598 | |
| 599 | func TestNewAPIKey(t *testing.T) { |
| 600 | name := "Test Key" |
| 601 | ownerID := "owner_123" |
| 602 | scopes := []string{"read", "write"} |
| 603 | expiresAt := time.Now().Add(24 * time.Hour) |
| 604 | |
| 605 | apiKey, err := NewAPIKey(name, ownerID, scopes, expiresAt) |
| 606 | |
| 607 | assert.NoError(t, err) |
| 608 | assert.NotNil(t, apiKey) |
| 609 | assert.Contains(t, apiKey.APIKeyID, "api_key_") |
| 610 | assert.NotEmpty(t, apiKey.Key) |
| 611 | assert.Equal(t, name, apiKey.Name) |
| 612 | assert.Equal(t, ownerID, apiKey.OwnerID) |
| 613 | assert.Equal(t, scopes, apiKey.Scopes) |
| 614 | assert.Equal(t, expiresAt, apiKey.ExpiresAt) |
| 615 | assert.False(t, apiKey.IsRevoked) |
| 616 | } |
| 617 | |
| 618 | func TestAPIKey_IsValid(t *testing.T) { |
| 619 | t.Run("Valid key - not revoked and not expired", func(t *testing.T) { |
nothing calls this directly
no test coverage detected