forked from prism4time/openvas-golang-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd_target_test.go
45 lines (37 loc) · 869 Bytes
/
cmd_target_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
package omp
import (
"fmt"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestTarget(t *testing.T) {
Convey("new omp", t, func() {
var id string
var err error
omp, err := New(vasTestAddr, "admin", "securepassword41")
So(err, ShouldBeNil)
So(omp, ShouldNotBeNil)
Convey("create target", func() {
target := Target{
Name: "test target",
Hosts: []string{"localhost"},
}
id, err = omp.CreateTarget(&target)
So(err, ShouldBeNil)
fmt.Println("target id:", id)
Convey("modify target", func() {
target := Target{
ID: id,
Hosts: []string{"localhost"},
ExcludeHosts: []string{"127.0.0.1"},
}
err := omp.ModifyTarget(&target)
So(err, ShouldBeNil)
Convey("delete target", func() {
err := omp.DeleteTarget(id)
So(err, ShouldBeNil)
})
})
})
})
}