Skip to content

Commit

Permalink
Provider configurations: Owners and Share with all environments setti… (
Browse files Browse the repository at this point in the history
#148)

* Provider configurations: Owners and Share with all environments setting cannot be enabled simultaneously

* fix
  • Loading branch information
DayS1eeper committed May 20, 2024
1 parent e1741e6 commit 634aeba
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions provider_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ func TestProviderConfigurationUpdateScalr(t *testing.T) {
environment, deleteEnvironment := createEnvironment(t, client)
defer deleteEnvironment()

ownerTeam, ownerTeamCleanup := createTeam(t, client, nil)
defer ownerTeamCleanup()

t.Run("success scalr", func(t *testing.T) {
createOptions := ProviderConfigurationCreateOptions{
Account: &Account{ID: defaultAccountID},
Expand All @@ -571,24 +574,22 @@ func TestProviderConfigurationUpdateScalr(t *testing.T) {
ScalrToken: String(scalrToken),
IsShared: Bool(false),
Environments: []*Environment{environment},
Owners: []*Team{{ID: ownerTeam.ID}},
}
configuration, err := client.ProviderConfigurations.Create(ctx, createOptions)
if err != nil {
t.Fatal(err)
}
defer client.ProviderConfigurations.Delete(ctx, configuration.ID)

ownerTeam, ownerTeamCleanup := createTeam(t, client, nil)
defer ownerTeamCleanup()

updateOptions := ProviderConfigurationUpdateOptions{
Name: String("scalr_prod"),
ExportShellVariables: Bool(true),
ScalrHostname: String(scalrHostname + "/"),
ScalrToken: String(scalrToken),
IsShared: Bool(true),
Environments: []*Environment{},
Owners: []*Team{{ID: ownerTeam.ID}},
Owners: []*Team{},
}
updatedConfiguration, err := client.ProviderConfigurations.Update(
ctx, configuration.ID, updateOptions,
Expand All @@ -598,7 +599,7 @@ func TestProviderConfigurationUpdateScalr(t *testing.T) {
assert.Equal(t, *updateOptions.ExportShellVariables, updatedConfiguration.ExportShellVariables)
assert.Equal(t, *updateOptions.ScalrHostname, updatedConfiguration.ScalrHostname)
assert.Equal(t, *updateOptions.IsShared, updatedConfiguration.IsShared)
assert.Equal(t, &updateOptions.Owners, &updatedConfiguration.Owners)
assert.Len(t, updatedConfiguration.Owners, 0)
})
}

Expand Down

0 comments on commit 634aeba

Please sign in to comment.