Skip to content

Commit 23b4508

Browse files
jamengualclaude
andcommitted
test: Improve Azure credentials test coverage
Removes unused field assignments that triggered linter warnings. Adds additional assertions to improve test coverage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 96abdc5 commit 23b4508

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/auth/types/azure_credentials_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ func TestAzureCredentials_MultipleTokens(t *testing.T) {
117117
now := time.Now().UTC()
118118
c := &AzureCredentials{
119119
AccessToken: "access-token-here",
120-
TokenType: "Bearer",
121-
Expiration: now.Add(1 * time.Hour).Format(time.RFC3339),
122120
GraphAPIToken: "graph-token-here",
123121
GraphAPIExpiration: now.Add(1 * time.Hour).Format(time.RFC3339),
124122
KeyVaultToken: "keyvault-token-here",
125123
KeyVaultExpiration: now.Add(1 * time.Hour).Format(time.RFC3339),
124+
Expiration: now.Add(1 * time.Hour).Format(time.RFC3339),
125+
TenantID: "tenant-123",
126+
SubscriptionID: "sub-456",
126127
}
127128

128129
// Verify all tokens are present.
@@ -132,14 +133,16 @@ func TestAzureCredentials_MultipleTokens(t *testing.T) {
132133
assert.NotEmpty(t, c.Expiration, "Expiration should be set")
133134
assert.NotEmpty(t, c.GraphAPIExpiration, "GraphAPIExpiration should be set")
134135
assert.NotEmpty(t, c.KeyVaultExpiration, "KeyVaultExpiration should be set")
136+
137+
// Test that they're not expired.
138+
assert.False(t, c.IsExpired(), "Credentials should not be expired")
135139
}
136140

137141
func TestAzureCredentials_EmptyOptionalFields(t *testing.T) {
138142
// Test that credentials work with only required fields.
139143
now := time.Now().UTC()
140144
c := &AzureCredentials{
141145
AccessToken: "access-token-here",
142-
TokenType: "Bearer",
143146
Expiration: now.Add(1 * time.Hour).Format(time.RFC3339),
144147
TenantID: "12345678-1234-1234-1234-123456789012",
145148
SubscriptionID: "87654321-4321-4321-4321-210987654321",
@@ -150,6 +153,7 @@ func TestAzureCredentials_EmptyOptionalFields(t *testing.T) {
150153
assert.NotEmpty(t, c.AccessToken, "AccessToken should be set")
151154
assert.NotEmpty(t, c.TenantID, "TenantID should be set")
152155
assert.NotEmpty(t, c.SubscriptionID, "SubscriptionID should be set")
156+
assert.False(t, c.IsExpired(), "Credentials should not be expired")
153157

154158
// Verify optional fields are empty.
155159
assert.Empty(t, c.GraphAPIToken, "GraphAPIToken should be empty")

0 commit comments

Comments
 (0)