blob: fa76cd84c1beac74f80136fa84e27236cbef2b7d (
plain)
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 libvirt
import (
"encoding/xml"
"testing"
"github.com/libvirt/libvirt-go-xml"
)
func TestGetHostXMLDesc(t *testing.T) {
ip := "127.0.0.1"
mac := "XX:YY:ZZ"
name := "localhost"
data := getHostXMLDesc(ip, mac, name)
dd := libvirtxml.NetworkDHCPHost{}
err := xml.Unmarshal([]byte(data), &dd)
if err != nil {
t.Errorf("error %v", err)
}
if dd.IP != ip {
t.Errorf("expected ip %s, got %s", ip, dd.IP)
}
if dd.MAC != mac {
t.Errorf("expected mac %s, got %s", mac, dd.MAC)
}
if dd.Name != name {
t.Errorf("expected name %s, got %s", name, dd.Name)
}
}
|