-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient_test.go
58 lines (52 loc) · 1.04 KB
/
client_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
56
57
58
package vulfocus
import (
"fmt"
"testing"
)
const (
addr = "http://vulfocus.fofa.so"
username = ""
licence = ""
)
func TestClient_GetImages(t *testing.T) {
client := NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
t.Error(err)
}
fmt.Printf("get %d images", len(images))
}
func TestClient_Start(t *testing.T) {
client := NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
t.Error(err)
}
err, exposed := client.Start(images[0].Name)
if err != nil {
t.Error(err)
}
println(exposed.Host, exposed.Port)
}
func TestClient_Stop(t *testing.T) {
client := NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
t.Error(err)
}
err = client.Stop(images[0].Name)
if err != nil {
t.Error(err)
}
}
func TestClient_Delete(t *testing.T) {
client := NewClient(addr, username, licence)
err, images := client.GetImages()
if err != nil {
t.Error(err)
}
err = client.Delete(images[0].Name)
if err != nil {
t.Error(err)
}
}