2017-08-14 20:17:11 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/tockins/realize/settings"
|
|
|
|
"net/http"
|
2017-08-14 20:49:51 +00:00
|
|
|
"testing"
|
2017-08-14 20:17:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestServer_Start(t *testing.T) {
|
|
|
|
s := settings.Settings{
|
|
|
|
Server: settings.Server{
|
|
|
|
Status: true,
|
|
|
|
Open: false,
|
2017-08-14 20:49:51 +00:00
|
|
|
Host: "localhost",
|
|
|
|
Port: 5000,
|
2017-08-14 20:17:11 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
server := Server{
|
2017-08-14 20:49:51 +00:00
|
|
|
Settings: &s,
|
2017-08-14 20:17:11 +00:00
|
|
|
}
|
|
|
|
err := server.Start(nil)
|
2017-08-14 20:49:51 +00:00
|
|
|
if err != nil {
|
2017-08-14 20:23:59 +00:00
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2017-08-14 20:17:11 +00:00
|
|
|
host := "http://localhost:5000/"
|
|
|
|
urls := []string{
|
|
|
|
host,
|
2017-08-14 20:49:51 +00:00
|
|
|
host + "assets/js/all.min.js",
|
|
|
|
host + "assets/css/app.css",
|
|
|
|
host + "app/components/settings/index.html",
|
|
|
|
host + "app/components/project/index.html",
|
|
|
|
host + "app/components/project/index.html",
|
|
|
|
host + "app/components/index.html",
|
|
|
|
host + "assets/img/svg/ic_settings_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_keyboard_backspace_black_24px.svg",
|
|
|
|
host + "assets/img/svg/ic_error_black_48px.svg",
|
|
|
|
host + "assets/img/svg/ic_remove_black_24px.svg",
|
|
|
|
host + "assets/img/svg/logo.svg",
|
|
|
|
host + "assets/img/favicon-32x32.png",
|
|
|
|
host + "assets/img/svg/ic_swap_vertical_circle_black_48px.svg",
|
2017-08-14 20:17:11 +00:00
|
|
|
}
|
|
|
|
for _, elm := range urls {
|
2017-08-14 20:23:59 +00:00
|
|
|
resp, err := http.Get(elm)
|
|
|
|
if err != nil || resp.StatusCode != 200 {
|
2017-08-14 20:49:51 +00:00
|
|
|
t.Fatal(err, resp.StatusCode, elm)
|
2017-08-14 20:17:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|