pull/490/head
Hunter Long 2020-04-08 19:10:43 -07:00
parent bbfb21ec03
commit afd7fa5db1
4 changed files with 9 additions and 29 deletions

View File

@ -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

View File

@ -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,

View File

@ -52,7 +52,7 @@ func TestGroupAPIRoutes(t *testing.T) {
URL: "/api/groups",
Method: "GET",
ExpectedStatus: 200,
ResponseLen: 2,
ResponseLen: 3,
BeforeTest: UnsetTestENV,
},
{

View File

@ -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