Adding unit tests for System
This commit is contained in:
parent
2fe742f4f8
commit
e1e2fefef4
23
system_test.go
Normal file
23
system_test.go
Normal file
@ -0,0 +1,23 @@
|
||||
package owrt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestService(t *testing.T) {
|
||||
exec := createMockExecutor("", "", 0)
|
||||
sys := NewSystemWithExecutor(exec)
|
||||
res := sys.Service("network", "start")
|
||||
if res.ReturnCode != 0 {
|
||||
t.Error("Bad Return Code !")
|
||||
}
|
||||
if res.Stdout != "" {
|
||||
fmt.Printf("[%s] - ", res.Stdout)
|
||||
t.Error("Stdout is not empty ...")
|
||||
}
|
||||
if res.Stderr != "" {
|
||||
fmt.Printf("[%s] - ", res.Stdout)
|
||||
t.Error("Stderr is not empty ...")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user