Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Schumann <[email protected]>
  • Loading branch information
janschumann committed Jun 21, 2024
1 parent 9aa36fc commit 59762f6
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,12 @@ func deleteAppfwprofile_sqlinjection_bindingFunc(d *schema.ResourceData, meta in
args["sqlinjection"] = sqlinjection
args["formactionurl_sql"] = url.QueryEscape(d.Get("formactionurl_sql").(string))
args["as_scan_location_sql"] = d.Get("as_scan_location_sql").(string)
args["as_value_type_sql"] = d.Get("as_value_type_sql").(string)
args["as_value_expr_sql"] = d.Get("as_value_expr_sql").(string)
if val, ok := d.GetOk("as_value_type_sql"); ok {
args["as_value_type_sql"] = val.(string)
}
if val, ok := d.GetOk("as_value_expr_sql"); ok {
args["as_value_expr_sql"] = val.(string)
}

err := client.DeleteResourceWithArgsMap(service.Appfwprofile_sqlinjection_binding.Type(), appFwName, args)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,51 @@ const testAccAppfwprofile_sqlinjection_binding_basic = `
}
`

const testAccAppfwprofile_sqlinjection_binding_as_value_type_sql = `
resource citrixadc_appfwprofile_sqlinjection_binding demo_as_value_type_sql_binding {
name = citrixadc_appfwprofile.demo_appfw_as_value_type_sql.name
sqlinjection= "demo_binding"
as_scan_location_sql= "HEADER"
as_value_type_sql= "Keyword"
as_value_expr_sql= "example1"
formactionurl_sql= "www.example.com"
state= "ENABLED"
isregex_sql= "NOTREGEX"
}
resource citrixadc_appfwprofile demo_appfw_as_value_type_sql {
name = "demo_appfw_as_value_type_sql"
bufferoverflowaction = ["none"]
contenttypeaction = ["none"]
cookieconsistencyaction = ["none"]
creditcard = ["none"]
creditcardaction = ["none"]
crosssitescriptingaction = ["none"]
csrftagaction = ["none"]
denyurlaction = ["none"]
dynamiclearning = ["none"]
fieldconsistencyaction = ["none"]
fieldformataction = ["none"]
fileuploadtypesaction = ["none"]
inspectcontenttypes = ["none"]
jsondosaction = ["none"]
jsonsqlinjectionaction = ["none"]
jsonxssaction = ["none"]
multipleheaderaction = ["none"]
sqlinjectionaction = ["none"]
starturlaction = ["none"]
type = ["HTML"]
xmlattachmentaction = ["none"]
xmldosaction = ["none"]
xmlformataction = ["none"]
xmlsoapfaultaction = ["none"]
xmlsqlinjectionaction = ["none"]
xmlvalidationaction = ["none"]
xmlwsiaction = ["none"]
xmlxssaction = ["none"]
}
`

func TestAccAppfwprofile_sqlinjection_binding_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -84,6 +129,17 @@ func TestAccAppfwprofile_sqlinjection_binding_basic(t *testing.T) {
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_binding", "formactionurl_sql", "www.example.com"),
),
},
{
Config: testAccAppfwprofile_sqlinjection_binding_as_value_type_sql,
Check: resource.ComposeTestCheckFunc(
testAccCheckAppfwprofile_sqlinjection_bindingExist("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", nil),
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "name", "demo_appfw_as_value_type_sql"),
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "as_scan_location_sql", "HEADER"),
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "formactionurl_sql", "www.example.com"),
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "as_value_type_sql", "Keyword"),
resource.TestCheckResourceAttr("citrixadc_appfwprofile_sqlinjection_binding.demo_as_value_type_sql_binding", "as_value_expr_sql", "example1"),
),
},
},
})
}
Expand Down

0 comments on commit 59762f6

Please sign in to comment.