Skip to content

Commit

Permalink
fix: refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaishak Dinesh committed Dec 20, 2024
1 parent 5cc721a commit 517c699
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
10 changes: 0 additions & 10 deletions internal/services/api_shield_operation/custom.go

This file was deleted.

11 changes: 1 addition & 10 deletions internal/services/api_shield_operation/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ func TestAccCloudflareAPIShieldOperation_Create(t *testing.T) {
resource.TestCheckResourceAttr(resourceID, "method", "GET"),
resource.TestCheckResourceAttr(resourceID, "host", domain),
resource.TestCheckResourceAttr(resourceID, "endpoint", "/example/path"),
resource.TestCheckResourceAttr(resourceID, "operations.0.method", "GET"),
resource.TestCheckResourceAttr(resourceID, "operations.0.host", domain),
resource.TestCheckResourceAttr(resourceID, "operations.0.endpoint", "/example/path"),
),
},
},
Expand Down Expand Up @@ -74,9 +71,6 @@ func TestAccCloudflareAPIShieldOperation_ForceNew(t *testing.T) {
resource.TestCheckResourceAttr(resourceID, "method", "GET"),
resource.TestCheckResourceAttr(resourceID, "host", domain),
resource.TestCheckResourceAttr(resourceID, "endpoint", "/example/path"),
resource.TestCheckResourceAttr(resourceID, "operations.0.method", "GET"),
resource.TestCheckResourceAttr(resourceID, "operations.0.host", domain),
resource.TestCheckResourceAttr(resourceID, "operations.0.endpoint", "/example/path"),
),
},
{
Expand All @@ -86,17 +80,14 @@ func TestAccCloudflareAPIShieldOperation_ForceNew(t *testing.T) {
resource.TestCheckResourceAttr(resourceID, "method", "POST"), // check that we've 'updated' the value
resource.TestCheckResourceAttr(resourceID, "host", domain),
resource.TestCheckResourceAttr(resourceID, "endpoint", "/example/path"),
resource.TestCheckResourceAttr(resourceID, "operations.0.method", "POST"), // check that we've 'updated' the value
resource.TestCheckResourceAttr(resourceID, "operations.0.host", domain),
resource.TestCheckResourceAttr(resourceID, "operations.0.endpoint", "/example/path"),
),
},
},
})
}

func testAccCheckAPIShieldOperationDelete(s *terraform.State) error {
client := acctest.SharedClient() // TODO(terraform): replace with SharedV2Clent
client := acctest.SharedClient()

for _, rs := range s.RootModule().Resources {
if rs.Type != "cloudflare_api_shield_operation" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
resource "cloudflare_api_shield_operation" "%[1]s" {
zone_id = "%[2]s"
operations = [
{
method = "%[3]s"
host = "%[4]s"
endpoint = "%[5]s"
}
]
}
zone_id = "%[2]s"
method = "%[3]s"
host = "%[4]s"
endpoint = "%[5]s"
}

0 comments on commit 517c699

Please sign in to comment.