1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00
shirou_gopsutil/host_test.go

38 lines
568 B
Go
Raw Normal View History

2014-04-22 09:44:22 +09:00
package gopsutil
2014-04-18 16:34:47 +09:00
import (
"testing"
)
func TestHostInfo(t *testing.T) {
v, err := HostInfo()
2014-04-18 16:34:47 +09:00
if err != nil {
t.Errorf("error %v", err)
}
if v.Hostname == "" {
t.Errorf("Could not get hostinfo %v", v)
}
}
func TestBoot_time(t *testing.T) {
2014-04-30 15:32:05 +09:00
v, err := BootTime()
if err != nil {
t.Errorf("error %v", err)
}
if v == 0 {
t.Errorf("Could not boot time %v", v)
2014-04-18 16:34:47 +09:00
}
}
2014-04-22 17:38:47 +09:00
func TestUsers(t *testing.T) {
v, err := Users()
if err != nil {
t.Errorf("error %v", err)
}
2014-04-22 17:39:51 +09:00
for _, u := range v {
if u.User == "" {
2014-04-22 17:38:47 +09:00
t.Errorf("Could not Users %v", v)
}
}
}