@@ -1027,14 +1027,20 @@ func configureVCR(t *testing.T, h *create.Harness) {
1027
1027
result = strings .Replace (result , os .Getenv ("TEST_ORG_ID" ), "123450001" , - 1 )
1028
1028
}
1029
1029
1030
- // Replace user info
1031
- obj := make (map [string ]any )
1032
- if err := json .Unmarshal ([]byte (s ), & obj ); err == nil {
1033
- toReplace , _ , _ := unstructured .NestedString (obj , "user" )
1034
- if len (toReplace ) != 0 {
1035
- result = strings .
Replace (
result ,
toReplace ,
"[email protected] " ,
- 1 )
1030
+ addReplacement := func (path string , newValue string ) {
1031
+ tokens := strings .Split (path , "." )
1032
+ obj := make (map [string ]any )
1033
+ if err := json .Unmarshal ([]byte (s ), & obj ); err == nil {
1034
+ toReplace , found , _ := unstructured .NestedString (obj , tokens ... )
1035
+ if found {
1036
+ result = strings .Replace (result , toReplace , newValue , - 1 )
1037
+ }
1036
1038
}
1037
1039
}
1040
+ // Replace user info
1041
+ addReplacement (
"user" ,
"[email protected] " )
1042
+ // Replace billing account name
1043
+ addReplacement ("billingAccountName" , "billingAccounts/123456-777777-000001" )
1038
1044
return result
1039
1045
}
1040
1046
0 commit comments