test(alerting): fixes broken unittests

This commit is contained in:
bergquist
2016-06-10 13:47:54 +02:00
parent 3c0b5fe78e
commit ea8fb66f73
14 changed files with 88 additions and 121 deletions
+8 -8
View File
@@ -6,7 +6,7 @@ import (
"github.com/grafana/grafana/pkg/components/simplejson"
)
type AlertRuleDAO struct {
type AlertRuleModel struct {
Id int64
OrgId int64
DashboardId int64
@@ -21,15 +21,15 @@ type AlertRuleDAO struct {
Expression *simplejson.Json
}
func (this AlertRuleDAO) TableName() string {
func (this AlertRuleModel) TableName() string {
return "alert_rule"
}
func (alertRule *AlertRuleDAO) ValidToSave() bool {
func (alertRule *AlertRuleModel) ValidToSave() bool {
return alertRule.DashboardId != 0
}
func (this *AlertRuleDAO) ContainsUpdates(other *AlertRuleDAO) bool {
func (this *AlertRuleModel) ContainsUpdates(other *AlertRuleModel) bool {
result := false
result = result || this.Name != other.Name
result = result || this.Description != other.Description
@@ -83,7 +83,7 @@ type SaveAlertsCommand struct {
UserId int64
OrgId int64
Alerts []*AlertRuleDAO
Alerts []*AlertRuleModel
}
type DeleteAlertCommand struct {
@@ -97,17 +97,17 @@ type GetAlertsQuery struct {
DashboardId int64
PanelId int64
Result []*AlertRuleDAO
Result []*AlertRuleModel
}
type GetAllAlertsQuery struct {
Result []*AlertRuleDAO
Result []*AlertRuleModel
}
type GetAlertByIdQuery struct {
Id int64
Result *AlertRuleDAO
Result *AlertRuleModel
}
type GetAlertChangesQuery struct {
+1 -1
View File
@@ -31,7 +31,7 @@ type UpdateAlertStateCommand struct {
NewState string `json:"newState" binding:"Required"`
Info string `json:"info"`
Result *AlertRuleDAO
Result *AlertRuleModel
}
// Queries
+2 -2
View File
@@ -13,13 +13,13 @@ func TestAlertingModelTest(t *testing.T) {
json1, _ := simplejson.NewJson([]byte(`{ "field": "value" }`))
json2, _ := simplejson.NewJson([]byte(`{ "field": "value" }`))
rule1 := &AlertRuleDAO{
rule1 := &AlertRuleModel{
Expression: json1,
Name: "Namn",
Description: "Description",
}
rule2 := &AlertRuleDAO{
rule2 := &AlertRuleModel{
Expression: json2,
Name: "Namn",
Description: "Description",