forked from gost/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
executable file
·32 lines (25 loc) · 782 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"testing"
)
func TestVersionHandler(t *testing.T) {
//arrange
/*server := "localhost"
port := 8088
cfg := configuration.Config{}
mqttServer := mqtt.CreateMQTTClient(configuration.MQTTConfig{})
database := postgis.NewDatabase("", 123, "", "", "", "", false, 50, 100, 200)
api := api.NewAPI(database, cfg, mqttServer)
api.Start()
gostServer := http.CreateServer(server, port, &api, false, nil, nil)
go gostServer.Start()
versionURL := fmt.Sprintf("%s/Version", "http://"+server+":"+strconv.Itoa(port))
fmt.Println(versionURL)
// act
request, _ := net.NewRequest("GET", versionURL, nil)
res, _ := net.DefaultClient.Do(request)
//assert
assert.Equal(t, 200, res.StatusCode, "result should be http 200")
// teardown
gostServer.Stop()*/
}