@@ -4,8 +4,11 @@ import (
44 "fmt"
55 "testing"
66
7+ "github.com/hashicorp/terraform-plugin-testing/compare"
78 "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
89 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
10+ "github.com/hashicorp/terraform-plugin-testing/statecheck"
11+ "github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
912)
1013
1114func TestAccGithubRepositoryPagesDataSource (t * testing.T ) {
@@ -49,12 +52,12 @@ func TestAccGithubRepositoryPagesDataSource(t *testing.T) {
4952 Steps : []resource.TestStep {
5053 {
5154 Config : config ,
52- Check : resource . ComposeTestCheckFunc (
53- resource . TestCheckResourceAttr ("data.github_repository_pages.test" , "build_type" , "legacy" ),
54- resource . TestCheckResourceAttr ("data.github_repository_pages.test" , "source.0. branch" , "main" ),
55- resource . TestCheckResourceAttr ("data.github_repository_pages.test" , "source.0. path" , "/" ),
56- resource . TestCheckResourceAttrSet ("data.github_repository_pages.test" , "url" ),
57- ) ,
55+ ConfigStateChecks : []statecheck. StateCheck {
56+ statecheck . CompareValuePairs ("data.github_repository_pages.test" , tfjsonpath . New ( "build_type" ) , "github_repository_pages.test" , tfjsonpath . New ( "build_type" ), compare . ValuesSame () ),
57+ statecheck . CompareValuePairs ("data.github_repository_pages.test" , tfjsonpath . New ( "source" ). AtSliceIndex ( 0 ). AtMapKey ( " branch") , "github_repository_pages.test" , tfjsonpath . New ( "source" ). AtSliceIndex ( 0 ). AtMapKey ( "branch" ), compare . ValuesSame () ),
58+ statecheck . CompareValuePairs ("data.github_repository_pages.test" , tfjsonpath . New ( "source" ). AtSliceIndex ( 0 ). AtMapKey ( " path") , "github_repository_pages.test" , tfjsonpath . New ( "source" ). AtSliceIndex ( 0 ). AtMapKey ( "path" ), compare . ValuesSame () ),
59+ statecheck . CompareValuePairs ("data.github_repository_pages.test" , tfjsonpath . New ( "api_url" ), "github_repository_pages.test" , tfjsonpath . New ( "api_url" ), compare . ValuesSame () ),
60+ } ,
5861 },
5962 },
6063 })
0 commit comments