(t *testing.T)
| 127 | } |
| 128 | |
| 129 | func TestInspectAPIKey_AdminKeySkipsGetApiKey(t *testing.T) { |
| 130 | stub := &stubAPIKeyInspector{ |
| 131 | listErr: nil, // admin keys can list API keys |
| 132 | getErr: errors.New("should not be called"), |
| 133 | } |
| 134 | |
| 135 | isAdmin, acls, err := inspectAPIKey(stub, "my-admin-key") |
| 136 | require.NoError(t, err) |
| 137 | assert.True(t, isAdmin) |
| 138 | assert.Nil(t, acls) |
| 139 | assert.False(t, stub.getCalled) |
| 140 | } |
| 141 | |
| 142 | func TestInspectAPIKey_NonAdminKeyReturnsACLs(t *testing.T) { |
| 143 | stub := &stubAPIKeyInspector{ |
nothing calls this directly
no test coverage detected