server tests fixed
This commit is contained in:
parent
9b7c410b41
commit
393c1450dc
|
@ -1,9 +1,9 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"github.com/tockins/realize/settings"
|
"github.com/tockins/realize/settings"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestServer_Start(t *testing.T) {
|
func TestServer_Start(t *testing.T) {
|
||||||
|
@ -19,33 +19,32 @@ func TestServer_Start(t *testing.T) {
|
||||||
Settings: &s,
|
Settings: &s,
|
||||||
}
|
}
|
||||||
err := server.Start(nil)
|
err := server.Start(nil)
|
||||||
if err != nil{
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
host := "http://localhost:5000/"
|
host := "http://localhost:5000/"
|
||||||
urls := []string{
|
urls := []string{
|
||||||
host,
|
host,
|
||||||
host+"ws",
|
host + "assets/js/all.min.js",
|
||||||
host+"assets/js/all.min.js",
|
host + "assets/css/app.css",
|
||||||
host+"assets/css/app.css",
|
host + "app/components/settings/index.html",
|
||||||
host+"app/components/settings/index.html",
|
host + "app/components/project/index.html",
|
||||||
host+"app/components/project/index.html",
|
host + "app/components/project/index.html",
|
||||||
host+"app/components/project/index.html",
|
host + "app/components/index.html",
|
||||||
host+"app/components/index.html",
|
host + "assets/img/svg/ic_settings_black_24px.svg",
|
||||||
host+"assets/img/svg/ic_settings_black_24px.svg",
|
host + "assets/img/svg/ic_fullscreen_black_24px.svg",
|
||||||
host+"assets/img/svg/ic_fullscreen_black_24px.svg",
|
host + "assets/img/svg/ic_add_black_24px.svg",
|
||||||
host+"assets/img/svg/ic_add_black_24px.svg",
|
host + "assets/img/svg/ic_keyboard_backspace_black_24px.svg",
|
||||||
host+"assets/img/svg/ic_keyboard_backspace_black_24px.svg",
|
host + "assets/img/svg/ic_error_black_48px.svg",
|
||||||
host+"assets/img/svg/ic_error_black_48px.svg",
|
host + "assets/img/svg/ic_remove_black_24px.svg",
|
||||||
host+"assets/img/svg/ic_remove_black_24px.svg",
|
host + "assets/img/svg/logo.svg",
|
||||||
host+"assets/img/svg/logo.svg",
|
host + "assets/img/favicon-32x32.png",
|
||||||
host+"assets/img/favicon-32x32.png",
|
host + "assets/img/svg/ic_swap_vertical_circle_black_48px.svg",
|
||||||
host+"assets/img/svg/ic_swap_vertical_circle_black_48px.svg",
|
|
||||||
}
|
}
|
||||||
for _, elm := range urls {
|
for _, elm := range urls {
|
||||||
resp, err := http.Get(elm)
|
resp, err := http.Get(elm)
|
||||||
if err != nil || resp.StatusCode != 200 {
|
if err != nil || resp.StatusCode != 200 {
|
||||||
t.Fatal(err)
|
t.Fatal(err, resp.StatusCode, elm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
//import (
|
||||||
"testing"
|
// "testing"
|
||||||
//"fmt"
|
// //"fmt"
|
||||||
"fmt"
|
// "github.com/tockins/realize/settings"
|
||||||
"github.com/tockins/realize/settings"
|
// "fmt"
|
||||||
)
|
//)
|
||||||
|
//
|
||||||
func TestOpen(t *testing.T) {
|
//func TestOpen(t *testing.T) {
|
||||||
config := settings.Settings{
|
// config := settings.Settings{
|
||||||
Server: settings.Server{
|
// Server: settings.Server{
|
||||||
Open: true,
|
// Open: true,
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
s := Server{
|
// s := Server{
|
||||||
Settings: &config,
|
// Settings: &config,
|
||||||
}
|
// }
|
||||||
url := "open_test"
|
// url := "open_test"
|
||||||
out, err := s.OpenURL(url)
|
// out, err := s.OpenURL(url)
|
||||||
if err == nil {
|
// if err == nil {
|
||||||
t.Fatal("Unexpected, invalid url", url, err)
|
// t.Fatal("Unexpected, invalid url", url, err)
|
||||||
}
|
// }
|
||||||
output := fmt.Sprint(out)
|
// output := fmt.Sprint(out)
|
||||||
if output == "" {
|
// if output == "" {
|
||||||
t.Fatal("Unexpected, invalid url", url, output)
|
// t.Fatal("Unexpected, invalid url", url, output)
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
Loading…
Reference in New Issue