@@ -2,10 +2,11 @@ package team_test
22
33import (
44 "fmt"
5- "github.com/port-labs/terraform-provider-port-labs/v2/internal/utils"
65 "os"
76 "testing"
87
8+ "github.com/port-labs/terraform-provider-port-labs/v2/internal/utils"
9+
910 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1011 "github.com/port-labs/terraform-provider-port-labs/v2/internal/acctest"
1112)
@@ -115,6 +116,47 @@ func TestAccPortTeamEmptyDescription(t *testing.T) {
115116 })
116117}
117118
119+ func TestAccPortTeamNameUpdate (t * testing.T ) {
120+ initialTeamName := utils .GenID ()
121+ updatedTeamName := utils .GenID ()
122+ var testAccTeamConfigCreate = fmt .Sprintf (`
123+ resource "port_team" "team" {
124+ name = "%s"
125+ description = "Test description"
126+ users = []
127+ }` , initialTeamName )
128+
129+ var testAccTeamConfigUpdate = fmt .Sprintf (`
130+ resource "port_team" "team" {
131+ name = "%s"
132+ description = "Test description"
133+ users = []
134+ }` , updatedTeamName )
135+
136+ resource .Test (t , resource.TestCase {
137+ PreCheck : func () { acctest .TestAccPreCheck (t ) },
138+ ProtoV6ProviderFactories : acctest .TestAccProtoV6ProviderFactories ,
139+ Steps : []resource.TestStep {
140+ {
141+ Config : acctest .ProviderConfig + testAccTeamConfigCreate ,
142+ Check : resource .ComposeTestCheckFunc (
143+ resource .TestCheckResourceAttr ("port_team.team" , "name" , initialTeamName ),
144+ resource .TestCheckResourceAttr ("port_team.team" , "description" , "Test description" ),
145+ resource .TestCheckResourceAttr ("port_team.team" , "users.#" , "0" ),
146+ ),
147+ },
148+ {
149+ Config : acctest .ProviderConfig + testAccTeamConfigUpdate ,
150+ Check : resource .ComposeTestCheckFunc (
151+ resource .TestCheckResourceAttr ("port_team.team" , "name" , updatedTeamName ),
152+ resource .TestCheckResourceAttr ("port_team.team" , "description" , "Test description" ),
153+ resource .TestCheckResourceAttr ("port_team.team" , "users.#" , "0" ),
154+ ),
155+ },
156+ },
157+ })
158+ }
159+
118160func TestAccPortTeamImport (t * testing.T ) {
119161 teamName := utils .GenID ()
120162 userName := os .Getenv ("CI_USER_NAME" )
0 commit comments