Skip to content

Commit

Permalink
Improved test names where there is layering
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardGomezEscandell committed Nov 20, 2023
1 parent a8545b8 commit f6f239a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions windows-agent/internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ func TestSubscription(t *testing.T) {
"Success when there is a user token": {settingsState: userTokenHasValue, wantToken: "user_token", wantSource: config.SourceUser},
"Success when there is a store token": {settingsState: storeTokenHasValue, wantToken: "store_token", wantSource: config.SourceMicrosoftStore},

"Success when there are organization and user tokens": {settingsState: orgTokenHasValue | userTokenHasValue, wantToken: "org_token", wantSource: config.SourceRegistry},
"Success when there are organization and store tokens": {settingsState: orgTokenHasValue | storeTokenHasValue, wantToken: "org_token", wantSource: config.SourceRegistry},
"Success when there are store and user tokens": {settingsState: userTokenHasValue | storeTokenHasValue, wantToken: "store_token", wantSource: config.SourceMicrosoftStore},
"Success when there are organization and user tokens, and an empty store token": {settingsState: orgTokenHasValue | userTokenHasValue | storeTokenExists, wantToken: "org_token", wantSource: config.SourceRegistry},
"Success when an organization token shadows a user token": {settingsState: orgTokenHasValue | userTokenHasValue, wantToken: "org_token", wantSource: config.SourceRegistry},
"Success when an organization token shadows a store token": {settingsState: orgTokenHasValue | storeTokenHasValue, wantToken: "org_token", wantSource: config.SourceRegistry},
"Success when a store token shadows a user token": {settingsState: userTokenHasValue | storeTokenHasValue, wantToken: "store_token", wantSource: config.SourceMicrosoftStore},
"Success when an organization token shadows a user token, and an empty store token": {settingsState: orgTokenHasValue | userTokenHasValue | storeTokenExists, wantToken: "org_token", wantSource: config.SourceRegistry},

"Error when the registry key cannot be opened": {settingsState: orgTokenHasValue, mockErrors: registry.MockErrOnOpenKey, wantError: true},
"Error when the registry key cannot be read from": {settingsState: orgTokenHasValue, mockErrors: registry.MockErrReadValue, wantError: true},
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestLandscapeConfig(t *testing.T) {
"Success when there is an organization conf": {settingsState: orgLandscapeConfigHasValue, wantLandscapeConfig: "[client]\nuser=BigOrg", wantSource: config.SourceRegistry},
"Success when there is a user conf": {settingsState: userLandscapeConfigHasValue, wantLandscapeConfig: "[client]\nuser=JohnDoe", wantSource: config.SourceUser},

"Success when there are organization and user confs": {settingsState: orgLandscapeConfigHasValue | userLandscapeConfigHasValue, wantLandscapeConfig: "[client]\nuser=BigOrg", wantSource: config.SourceRegistry},
"Success when an organization config shadows a user config": {settingsState: orgLandscapeConfigHasValue | userLandscapeConfigHasValue, wantLandscapeConfig: "[client]\nuser=BigOrg", wantSource: config.SourceRegistry},

"Error when the registry key cannot be opened": {settingsState: orgTokenHasValue, mockErrors: registry.MockErrOnOpenKey, wantError: true},
"Error when the registry key cannot be read from": {settingsState: orgTokenHasValue, mockErrors: registry.MockErrReadValue, wantError: true},
Expand Down

0 comments on commit f6f239a

Please sign in to comment.