added some basic tests for web.go
This commit is contained in:
parent
1e3608af6c
commit
71c8c0ba75
1 changed files with 67 additions and 0 deletions
67
web/web_test.go
Normal file
67
web/web_test.go
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
package web
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestIndex(t *testing.T) {
|
||||||
|
router := NewWeb()
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("GET", "/", nil)
|
||||||
|
router.router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
if w.Code != 200 {
|
||||||
|
t.Error("Status != 200")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNotifiersView(t *testing.T) {
|
||||||
|
router := NewWeb()
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("GET", "/notifiers/view", nil)
|
||||||
|
router.router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
if w.Code != 200 {
|
||||||
|
t.Error("Status != 200")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSchedulesView(t *testing.T) {
|
||||||
|
router := NewWeb()
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("GET", "/schedules/view", nil)
|
||||||
|
router.router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
if w.Code != 200 {
|
||||||
|
t.Error("Status != 200")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateWatchGet(t *testing.T) {
|
||||||
|
router := NewWeb()
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("GET", "/watch/create", nil)
|
||||||
|
router.router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
if w.Code != 200 {
|
||||||
|
t.Error("Status != 200")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCreateBackupView(t *testing.T) {
|
||||||
|
router := NewWeb()
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
|
||||||
|
req, _ := http.NewRequest("GET", "/backup/view", nil)
|
||||||
|
router.router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
if w.Code != 200 {
|
||||||
|
t.Error("Status != 200")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue