statping/handlers/users_test.go

32 lines
657 B
Go
Raw Normal View History

2019-01-15 01:28:00 +00:00
package handlers
import (
2019-12-30 00:40:20 +00:00
"github.com/stretchr/testify/require"
2019-01-15 01:28:00 +00:00
"testing"
)
func TestUserRoutes(t *testing.T) {
tests := []HTTPTest{
{
Name: "Users",
URL: "/users",
Method: "GET",
ExpectedStatus: 200,
ExpectedContains: []string{`<title>Statping | Users</title>`},
},
{
Name: "User 2",
URL: "/user/2",
Method: "GET",
ExpectedStatus: 200,
2019-12-30 00:40:20 +00:00
ExpectedContains: []string{`<title>Statping | testadmin2</title>`},
2019-01-15 01:28:00 +00:00
}}
for _, v := range tests {
t.Run(v.Name, func(t *testing.T) {
2019-02-04 18:52:41 +00:00
_, t, err := RunHTTPTest(v, t)
2019-12-30 00:40:20 +00:00
require.Nil(t, err)
2019-01-15 01:28:00 +00:00
})
}
}