2015-06-04 18:23:11 +02:00
|
|
|
package checks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFileChecker(t *testing.T) {
|
|
|
|
if err := FileChecker("/tmp").Check(); err == nil {
|
|
|
|
t.Errorf("/tmp was expected as exists")
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := FileChecker("NoSuchFileFromMoon").Check(); err != nil {
|
|
|
|
t.Errorf("NoSuchFileFromMoon was expected as not exists, error:%v", err)
|
|
|
|
}
|
|
|
|
}
|
2015-06-09 19:39:34 +02:00
|
|
|
|
|
|
|
func TestHTTPChecker(t *testing.T) {
|
2015-08-20 03:23:58 +02:00
|
|
|
if err := HTTPChecker("https://www.google.cybertron", 200, 0, nil).Check(); err == nil {
|
2015-06-09 19:39:34 +02:00
|
|
|
t.Errorf("Google on Cybertron was expected as not exists")
|
|
|
|
}
|
|
|
|
|
2015-08-20 03:23:58 +02:00
|
|
|
if err := HTTPChecker("https://www.google.pt", 200, 0, nil).Check(); err != nil {
|
2015-06-09 19:39:34 +02:00
|
|
|
t.Errorf("Google at Portugal was expected as exists, error:%v", err)
|
|
|
|
}
|
|
|
|
}
|