-
Notifications
You must be signed in to change notification settings - Fork 1
/
user_test.go
54 lines (46 loc) · 1.16 KB
/
user_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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package rest_test
import (
"os"
"testing"
"github.com/openchirp/framework/rest"
)
func TestHost_RequestLocationInfo(t *testing.T) {
// Get parameters from environment variables
frameworkUri := os.Getenv("FRAMEWORK_SERVER")
id := os.Getenv("USER_ID")
token := os.Getenv("USER_TOKEN")
host := rest.NewHost(frameworkUri)
if err := host.Login(id, token); err != nil {
t.Error("Error logging in:", err)
return
}
lInfo, err := host.RequestLocationInfo("")
if err != nil {
t.Error("Error requesting root location info:", err)
return
}
t.Log(lInfo)
lInfo, err = host.RequestLocationInfo(lInfo.Children[0])
if err != nil {
t.Error("Error requesting location info:", err)
return
}
t.Log(lInfo)
}
func TestHost_RequestUserInfo(t *testing.T) {
// Get parameters from environment variables
frameworkUri := os.Getenv("FRAMEWORK_SERVER")
id := os.Getenv("USER_ID")
token := os.Getenv("USER_TOKEN")
host := rest.NewHost(frameworkUri)
if err := host.Login(id, token); err != nil {
t.Error("Error logging in:", err)
return
}
uInfo, err := host.RequestUserInfo()
if err != nil {
t.Error("Error requesting user info:", err)
return
}
t.Log(uInfo)
}