Beispiel #1
0
func startServer() {
	http.Handle("/", handler.NewRouter())
	port := os.Getenv("PORT")
	host := os.Getenv("HOST")
	err := http.ListenAndServe(host+":"+port, nil)
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}
Beispiel #2
0
)

var (
	ts *httptest.Server
)

func TestBlackBox(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "Api WS")
}

var _ = BeforeSuite(func() {
	utils.LoadEnv("../.env_test")
	utils.InitLogger()
	models.InitDB()
	ts = httptest.NewServer(handler.NewRouter())
})

var _ = AfterSuite(func() {
	ts.Close()
	models.Session.Close()
	time.Sleep(1 * time.Second)
})

var _ = BeforeEach(func() {
	fmt.Println("----------------------------------------------------------------")
	cleanDB()
})

var _ = AfterEach(func() {
	fmt.Println("****************************************************************")