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 type HttpFuncTest func(*testing.T) error
// HTTPTest contains all the parameters for a HTTP Unit Test // HTTPTest contains all the parameters for a HTTP Unit Test

View File

@ -16,7 +16,7 @@ func TestApiCheckinRoutes(t *testing.T) {
SecureRoute: true, SecureRoute: true,
}, { }, {
Name: "Statping Create Checkin", Name: "Statping Create Checkin",
URL: "/api/checkin", URL: "/api/checkins",
Method: "POST", Method: "POST",
Body: `{ Body: `{
"service_id": 2, "service_id": 2,

View File

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

View File

@ -23,11 +23,11 @@ func TestApiServiceRoutes(t *testing.T) {
Method: "GET", Method: "GET",
ExpectedContains: []string{`"name":"Google"`}, ExpectedContains: []string{`"name":"Google"`},
ExpectedStatus: 200, ExpectedStatus: 200,
ResponseLen: 5, ResponseLen: 6,
BeforeTest: SetTestENV, BeforeTest: SetTestENV,
FuncTest: func(t *testing.T) error { FuncTest: func(t *testing.T) error {
count := len(services.Services()) count := len(services.Services())
if count != 5 { if count != 6 {
return errors.Errorf("incorrect services count: %d", count) return errors.Errorf("incorrect services count: %d", count)
} }
return nil return nil
@ -39,11 +39,11 @@ func TestApiServiceRoutes(t *testing.T) {
Method: "GET", Method: "GET",
ExpectedContains: []string{`"name":"Google"`}, ExpectedContains: []string{`"name":"Google"`},
ExpectedStatus: 200, ExpectedStatus: 200,
ResponseLen: 4, ResponseLen: 5,
BeforeTest: UnsetTestENV, BeforeTest: UnsetTestENV,
FuncTest: func(t *testing.T) error { FuncTest: func(t *testing.T) error {
count := len(services.Services()) count := len(services.Services())
if count != 5 { if count != 6 {
return errors.Errorf("incorrect services count: %d", count) return errors.Errorf("incorrect services count: %d", count)
} }
return nil return nil
@ -59,7 +59,7 @@ func TestApiServiceRoutes(t *testing.T) {
}, },
{ {
Name: "Statping Private Service 1", Name: "Statping Private Service 1",
URL: "/api/services/2", URL: "/api/services/6",
Method: "GET", Method: "GET",
ExpectedContains: []string{`"error":"not authenticated"`}, ExpectedContains: []string{`"error":"not authenticated"`},
ExpectedStatus: 200, ExpectedStatus: 200,
@ -176,7 +176,7 @@ func TestApiServiceRoutes(t *testing.T) {
ExpectedContains: []string{`"status":"success","type":"service","method":"create"`, `"public":false`, `"group_id":1`}, ExpectedContains: []string{`"status":"success","type":"service","method":"create"`, `"public":false`, `"group_id":1`},
FuncTest: func(t *testing.T) error { FuncTest: func(t *testing.T) error {
count := len(services.Services()) count := len(services.Services())
if count != 6 { if count != 7 {
return errors.Errorf("incorrect services count: %d", count) return errors.Errorf("incorrect services count: %d", count)
} }
return nil return nil
@ -238,7 +238,7 @@ func TestApiServiceRoutes(t *testing.T) {
ExpectedContains: []string{`"status":"success"`, `"method":"delete"`}, ExpectedContains: []string{`"status":"success"`, `"method":"delete"`},
FuncTest: func(t *testing.T) error { FuncTest: func(t *testing.T) error {
count := len(services.Services()) count := len(services.Services())
if count != 5 { if count != 6 {
return errors.Errorf("incorrect services count: %d", count) return errors.Errorf("incorrect services count: %d", count)
} }
return nil return nil