forked from prism4time/openvas-golang-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest_test.go
34 lines (28 loc) · 817 Bytes
/
request_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
package omp
import (
"encoding/xml"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestRequestAuth(t *testing.T) {
Convey("construct auth request", t, func() {
d := requestAuth{}
d.Credentials.Username = "username"
d.Credentials.Password = "password"
Convey("marshal auth request", func() {
b, err := xml.Marshal(d)
So(err, ShouldBeNil)
So(string(b), ShouldEqual, "<authenticate><credentials><username>username</username><password>password</password></credentials></authenticate>")
})
})
}
func TestRequestVersion(t *testing.T) {
Convey("construct version request", t, func() {
d := requestVersion{}
Convey("marshal version request", func() {
b, err := xml.Marshal(d)
So(err, ShouldBeNil)
So(string(b), ShouldEqual, "<get_version></get_version>")
})
})
}