Skip to content

Commit

Permalink
Add a test for renaming a project
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-futurice committed Jul 24, 2024
1 parent 1af500d commit 9fd535d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/provider/project/project_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func TestAccProjectResource_basic(t *testing.T) {
ctx := testutils.CreateTestContext(t)

projectName := acctest.RandomWithPrefix("test-project")
otherProjectName := acctest.RandomWithPrefix("other-test-project")
projectResourceName := createProjectResourceName("test")

testProject := dtrack.Project{
Expand All @@ -41,6 +42,9 @@ func TestAccProjectResource_basic(t *testing.T) {
Active: true,
}

testUpdatedProject := testProject
testUpdatedProject.Name = otherProjectName

resource.Test(t, resource.TestCase{
PreCheck: func() { testutils.TestAccPreCheck(t) },
ProtoV6ProviderFactories: testutils.TestAccProtoV6ProviderFactories,
Expand All @@ -62,6 +66,13 @@ func TestAccProjectResource_basic(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccProjectConfigBasic(testDependencyTrack, otherProjectName),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckProjectExistsAndHasExpectedData(ctx, testDependencyTrack, projectResourceName, testUpdatedProject),
resource.TestCheckResourceAttr(projectResourceName, "name", otherProjectName),
),
},
},
CheckDestroy: testAccCheckProjectDoesNotExists(ctx, testDependencyTrack, projectResourceName),
})
Expand Down

0 comments on commit 9fd535d

Please sign in to comment.