Commit 64431113 authored by Pablo Carranza's avatar Pablo Carranza 🦄

Add a test that gets the list of people who is on call now

parent 2b1dd9c5
Pipeline #13311197 passed with stage
in 1 minute and 11 seconds
......@@ -2,8 +2,11 @@ package oncall
import (
"fmt"
"os"
"testing"
"time"
"github.com/PagerDuty/go-pagerduty"
)
func TestOncallDates(t *testing.T) {
......@@ -45,3 +48,17 @@ func TestOncallDates(t *testing.T) {
})
}
}
func TestPagerDutyStuff(t *testing.T) {
APIKey := os.Getenv("PD_API_KEY")
PrimaryOnCall := "PQ9W7ID"
SecondaryOnCall := "P23P5AE"
client := pagerduty.NewClient(APIKey)
resp, _ := client.ListOnCalls(pagerduty.ListOnCallOptions{
ScheduleIDs: []string{PrimaryOnCall, SecondaryOnCall},
Until: fmt.Sprintf("%sT16:00:00Z", time.Now().Add(24*7*time.Hour).Format("2006-01-02")),
})
for _, o := range resp.OnCalls {
fmt.Printf("On Call Now: %+v\n", o)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment