Skip to content

Commit 59762f6

Browse files
committed
add tests
Signed-off-by: Jan Schumann <[email protected]>
1 parent 9aa36fc commit 59762f6

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

citrixadc/resource_citrixadc_appfwprofile_sqlinjection_binding.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,12 @@ func deleteAppfwprofile_sqlinjection_bindingFunc(d *schema.ResourceData, meta in
209209
args["sqlinjection"] = sqlinjection
210210
args["formactionurl_sql"] = url.QueryEscape(d.Get("formactionurl_sql").(string))
211211
args["as_scan_location_sql"] = d.Get("as_scan_location_sql").(string)
212-
args["as_value_type_sql"] = d.Get("as_value_type_sql").(string)
213-
args["as_value_expr_sql"] = d.Get("as_value_expr_sql").(string)
212+
if val, ok := d.GetOk("as_value_type_sql"); ok {
213+
args["as_value_type_sql"] = val.(string)
214+
}
215+
if val, ok := d.GetOk("as_value_expr_sql"); ok {
216+
args["as_value_expr_sql"] = val.(string)
217+
}
214218

215219
err := client.DeleteResourceWithArgsMap(service.Appfwprofile_sqlinjection_binding.Type(), appFwName, args)
216220
if err != nil {

citrixadc/resource_citrixadc_appfwprofile_sqlinjection_binding_test.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,51 @@ const testAccAppfwprofile_sqlinjection_binding_basic = `
6969
}
7070
`
7171

72+
const testAccAppfwprofile_sqlinjection_binding_as_value_type_sql = `
73+
resource citrixadc_appfwprofile_sqlinjection_binding demo_as_value_type_sql_binding {
74+
name = citrixadc_appfwprofile.demo_appfw_as_value_type_sql.name
75+
sqlinjection= "demo_binding"
76+
as_scan_location_sql= "HEADER"
77+
as_value_type_sql= "Keyword"
78+
as_value_expr_sql= "example1"
79+
formactionurl_sql= "www.example.com"
80+
state= "ENABLED"
81+
isregex_sql= "NOTREGEX"
82+
}
83+
84+
resource citrixadc_appfwprofile demo_appfw_as_value_type_sql {
85+
name = "demo_appfw_as_value_type_sql"
86+
bufferoverflowaction = ["none"]
87+
contenttypeaction = ["none"]
88+
cookieconsistencyaction = ["none"]
89+
creditcard = ["none"]
90+
creditcardaction = ["none"]
91+
crosssitescriptingaction = ["none"]
92+
csrftagaction = ["none"]
93+
denyurlaction = ["none"]
94+
dynamiclearning = ["none"]
95+
fieldconsistencyaction = ["none"]
96+
fieldformataction = ["none"]
97+
fileuploadtypesaction = ["none"]
98+
inspectcontenttypes = ["none"]
99+
jsondosaction = ["none"]
100+
jsonsqlinjectionaction = ["none"]
101+
jsonxssaction = ["none"]
102+
multipleheaderaction = ["none"]
103+
sqlinjectionaction = ["none"]
104+
starturlaction = ["none"]
105+
type = ["HTML"]
106+
xmlattachmentaction = ["none"]
107+
xmldosaction = ["none"]
108+
xmlformataction = ["none"]
109+
xmlsoapfaultaction = ["none"]
110+
xmlsqlinjectionaction = ["none"]
111+
xmlvalidationaction = ["none"]
112+
xmlwsiaction = ["none"]
113+
xmlxssaction = ["none"]
114+
}
115+
`
116+
72117
func TestAccAppfwprofile_sqlinjection_binding_basic(t *testing.T) {
73118
resource.Test(t, resource.TestCase{
74119
PreCheck: func() { testAccPreCheck(t) },
@@ -84,6 +129,17 @@ func TestAccAppfwprofile_sqlinjection_binding_basic(t *testing.T) {
84129
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_binding", "formactionurl_sql", "www.example.com"),
85130
),
86131
},
132+
{
133+
Config: testAccAppfwprofile_sqlinjection_binding_as_value_type_sql,
134+
Check: resource.ComposeTestCheckFunc(
135+
testAccCheckAppfwprofile_sqlinjection_bindingExist("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", nil),
136+
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "name", "demo_appfw_as_value_type_sql"),
137+
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "as_scan_location_sql", "HEADER"),
138+
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "formactionurl_sql", "www.example.com"),
139+
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "as_value_type_sql", "Keyword"),
140+
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "as_value_expr_sql", "example1"),
141+
),
142+
},
87143
},
88144
})
89145
}

0 commit comments

Comments
 (0)