mirror of https://github.com/statping/statping
tests
parent
bbfb21ec03
commit
afd7fa5db1
|
@ -195,26 +195,6 @@ func TestMainApiRoutes(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
//func TestExportSettings(t *testing.T) {
|
||||
// data, err := ExportSettings()
|
||||
// require.Nil(t, err)
|
||||
// assert.Len(t, data, 50)
|
||||
//
|
||||
// var exportData ExportData
|
||||
// err = json.Unmarshal(data, &exportData)
|
||||
// require.Nil(t, err)
|
||||
//
|
||||
// assert.Len(t, exportData.Services, 4)
|
||||
// assert.Len(t, exportData.Messages, 4)
|
||||
// assert.Len(t, exportData.Checkins, 2)
|
||||
// assert.Len(t, exportData.Groups, 1)
|
||||
//
|
||||
// assert.Equal(t, "Updated Core", exportData.Core.Name)
|
||||
// assert.True(t, exportData.Core.Setup)
|
||||
// assert.NotEmpty(t, exportData.Core.ApiKey)
|
||||
// assert.NotEmpty(t, exportData.Core.ApiSecret)
|
||||
//}
|
||||
|
||||
type HttpFuncTest func(*testing.T) error
|
||||
|
||||
// HTTPTest contains all the parameters for a HTTP Unit Test
|
||||
|
|
|
@ -16,7 +16,7 @@ func TestApiCheckinRoutes(t *testing.T) {
|
|||
SecureRoute: true,
|
||||
}, {
|
||||
Name: "Statping Create Checkin",
|
||||
URL: "/api/checkin",
|
||||
URL: "/api/checkins",
|
||||
Method: "POST",
|
||||
Body: `{
|
||||
"service_id": 2,
|
||||
|
|
|
@ -52,7 +52,7 @@ func TestGroupAPIRoutes(t *testing.T) {
|
|||
URL: "/api/groups",
|
||||
Method: "GET",
|
||||
ExpectedStatus: 200,
|
||||
ResponseLen: 2,
|
||||
ResponseLen: 3,
|
||||
BeforeTest: UnsetTestENV,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -23,11 +23,11 @@ func TestApiServiceRoutes(t *testing.T) {
|
|||
Method: "GET",
|
||||
ExpectedContains: []string{`"name":"Google"`},
|
||||
ExpectedStatus: 200,
|
||||
ResponseLen: 5,
|
||||
ResponseLen: 6,
|
||||
BeforeTest: SetTestENV,
|
||||
FuncTest: func(t *testing.T) error {
|
||||
count := len(services.Services())
|
||||
if count != 5 {
|
||||
if count != 6 {
|
||||
return errors.Errorf("incorrect services count: %d", count)
|
||||
}
|
||||
return nil
|
||||
|
@ -39,11 +39,11 @@ func TestApiServiceRoutes(t *testing.T) {
|
|||
Method: "GET",
|
||||
ExpectedContains: []string{`"name":"Google"`},
|
||||
ExpectedStatus: 200,
|
||||
ResponseLen: 4,
|
||||
ResponseLen: 5,
|
||||
BeforeTest: UnsetTestENV,
|
||||
FuncTest: func(t *testing.T) error {
|
||||
count := len(services.Services())
|
||||
if count != 5 {
|
||||
if count != 6 {
|
||||
return errors.Errorf("incorrect services count: %d", count)
|
||||
}
|
||||
return nil
|
||||
|
@ -59,7 +59,7 @@ func TestApiServiceRoutes(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Name: "Statping Private Service 1",
|
||||
URL: "/api/services/2",
|
||||
URL: "/api/services/6",
|
||||
Method: "GET",
|
||||
ExpectedContains: []string{`"error":"not authenticated"`},
|
||||
ExpectedStatus: 200,
|
||||
|
@ -176,7 +176,7 @@ func TestApiServiceRoutes(t *testing.T) {
|
|||
ExpectedContains: []string{`"status":"success","type":"service","method":"create"`, `"public":false`, `"group_id":1`},
|
||||
FuncTest: func(t *testing.T) error {
|
||||
count := len(services.Services())
|
||||
if count != 6 {
|
||||
if count != 7 {
|
||||
return errors.Errorf("incorrect services count: %d", count)
|
||||
}
|
||||
return nil
|
||||
|
@ -238,7 +238,7 @@ func TestApiServiceRoutes(t *testing.T) {
|
|||
ExpectedContains: []string{`"status":"success"`, `"method":"delete"`},
|
||||
FuncTest: func(t *testing.T) error {
|
||||
count := len(services.Services())
|
||||
if count != 5 {
|
||||
if count != 6 {
|
||||
return errors.Errorf("incorrect services count: %d", count)
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue