forked from pgaskin/easy-novnc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
novnc_test.go
55 lines (44 loc) · 1.02 KB
/
novnc_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
55
package main
import (
"io"
"io/ioutil"
"os"
"testing"
"github.com/shurcooL/httpfs/vfsutil"
)
func TestNoVNC(t *testing.T) {
f, err := noVNC.Open("noVNC-master")
if err != nil {
t.Errorf("could not open noVNC root dir: %v", err)
}
_, err = f.Readdir(1)
if err != nil {
t.Errorf("could not read noVNC root dir: %v", err)
}
f, err = noVNC.Open("noVNC-master/vnc.html")
if err != nil {
t.Errorf("could not open vnc.html: %v", err)
}
buf, err := ioutil.ReadAll(f)
if err != nil {
t.Errorf("could not read vnc.html: %v", err)
}
if len(buf) < 100 {
t.Errorf("vnc.html is too small")
}
f, err = noVNC.Open("noVNC-master/VERSION")
if err != nil {
t.Errorf("could not open VERSION: %v", err)
}
buf, err = ioutil.ReadAll(f)
if err != nil {
t.Errorf("could not read VERSION: %v", err)
}
t.Logf("noVNC %s", string(buf))
err = vfsutil.WalkFiles(noVNC, "/", func(path string, info os.FileInfo, rs io.ReadSeeker, err error) error {
return err
})
if err != nil {
t.Errorf("could not read fs: %v", err)
}
}