Commit 1f344202 by Leonard Gram

alerts: refactoring tests

parent c5226a94
...@@ -67,8 +67,7 @@ func TestAlertingDataAccess(t *testing.T) { ...@@ -67,8 +67,7 @@ func TestAlertingDataAccess(t *testing.T) {
So(err, ShouldBeNil) So(err, ShouldBeNil)
}) })
alert, err := getAlertById(1) alert, _ := getAlertById(1)
So(err, ShouldBeNil)
stateDateBeforePause := alert.NewStateDate stateDateBeforePause := alert.NewStateDate
Convey("can pause all alerts", func() { Convey("can pause all alerts", func() {
...@@ -237,14 +236,6 @@ func TestAlertingDataAccess(t *testing.T) { ...@@ -237,14 +236,6 @@ func TestAlertingDataAccess(t *testing.T) {
}) })
}) })
} }
func pauseAllAlerts(pauseState bool) error {
cmd := &m.PauseAllAlertCommand{
Paused: pauseState,
}
err := PauseAllAlerts(cmd)
So(err, ShouldBeNil)
return err
}
func TestPausingAlerts(t *testing.T) { func TestPausingAlerts(t *testing.T) {
mockTimeNow() mockTimeNow()
...@@ -262,8 +253,7 @@ func TestPausingAlerts(t *testing.T) { ...@@ -262,8 +253,7 @@ func TestPausingAlerts(t *testing.T) {
pauseAlert(testDash.OrgId, 1, true) pauseAlert(testDash.OrgId, 1, true)
Convey("the NewStateDate should be updated", func() { Convey("the NewStateDate should be updated", func() {
alert, err := getAlertById(1) alert, _ := getAlertById(1)
So(err, ShouldBeNil)
stateDateAfterPause = alert.NewStateDate stateDateAfterPause = alert.NewStateDate
So(stateDateBeforePause, ShouldHappenBefore, stateDateAfterPause) So(stateDateBeforePause, ShouldHappenBefore, stateDateAfterPause)
...@@ -274,8 +264,7 @@ func TestPausingAlerts(t *testing.T) { ...@@ -274,8 +264,7 @@ func TestPausingAlerts(t *testing.T) {
pauseAlert(testDash.OrgId, 1, false) pauseAlert(testDash.OrgId, 1, false)
Convey("the NewStateDate should be updated again", func() { Convey("the NewStateDate should be updated again", func() {
alert, err := getAlertById(1) alert, _ := getAlertById(1)
So(err, ShouldBeNil)
stateDateAfterUnpause := alert.NewStateDate stateDateAfterUnpause := alert.NewStateDate
So(stateDateAfterPause, ShouldHappenBefore, stateDateAfterUnpause) So(stateDateAfterPause, ShouldHappenBefore, stateDateAfterUnpause)
...@@ -325,3 +314,12 @@ func getAlertById(id int64) (*m.Alert, error) { ...@@ -325,3 +314,12 @@ func getAlertById(id int64) (*m.Alert, error) {
So(err, ShouldBeNil) So(err, ShouldBeNil)
return q.Result, err return q.Result, err
} }
func pauseAllAlerts(pauseState bool) error {
cmd := &m.PauseAllAlertCommand{
Paused: pauseState,
}
err := PauseAllAlerts(cmd)
So(err, ShouldBeNil)
return err
}
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