Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Add acceptance tests for monitor data source
Browse files Browse the repository at this point in the history
  • Loading branch information
evansmurithi committed Oct 28, 2020
1 parent bf944f3 commit 2cc63cb
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions uptimerobot/data_source_uptimerobot_monitor_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package uptimerobot

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestUptimeRobotDataSourceMonitor_basic(t *testing.T) {
var friendlyName = "TF Test: monitor"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
data "uptimerobot_monitor" "test" {
friendly_name = "%s"
}
`, friendlyName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.uptimerobot_monitor.test", "friendly_name", friendlyName),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "id"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "url"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "type"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "status"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "interval"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "sub_type"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "port"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "keyword_type"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "keyword_value"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "http_username"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "http_password"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "http_auth_type"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "custom_http_headers"),
resource.TestCheckResourceAttrSet("data.uptimerobot_monitor.test", "alert_contact"),
),
},
},
})
}

0 comments on commit 2cc63cb

Please sign in to comment.