Fixing tests for new specs
This commit is contained in:
parent
94b4b220c6
commit
dc195d0d21
|
@ -2,6 +2,7 @@ package openwrt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
@ -76,5 +77,6 @@ func parseDhcpClientOut(out *CommandResult) *DhcpResult {
|
||||||
// AskForIP runs a dhclient ip request with udhcpc
|
// AskForIP runs a dhclient ip request with udhcpc
|
||||||
func (dc *DhcpClient) AskForIP() *DhcpResult {
|
func (dc *DhcpClient) AskForIP() *DhcpResult {
|
||||||
out := dc.exec.Run("udhcpc", "-i", dc.iface)
|
out := dc.exec.Run("udhcpc", "-i", dc.iface)
|
||||||
|
fmt.Printf("%s\n", out.Stdout)
|
||||||
return parseDhcpClientOut(out)
|
return parseDhcpClientOut(out)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package openwrt
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
func TestDhcpClientAskForIP(t *testing.T) {
|
func TestDhcpClientAskForIP(t *testing.T) {
|
||||||
uexec := createMockExecutor("", "", 0)
|
uexec := createMockExecutor("udhcpc: ifconfig wlan1 192.168.42.20 netmask 255.255.255.0 broadcast +", "", 0)
|
||||||
dhc := NewDhcpClientWithExecutor("wlan1", uexec)
|
dhc := NewDhcpClientWithExecutor("wlan1", uexec)
|
||||||
res := dhc.AskForIP()
|
res := dhc.AskForIP()
|
||||||
if res.CmdRes.ReturnCode != 0 {
|
if res.CmdRes.ReturnCode != 0 {
|
||||||
|
|
|
@ -33,7 +33,7 @@ func TestGetWifiCells(t *testing.T) {
|
||||||
t.Errorf("The first Cell have a bad Encryption!\n %s is expected and we have %s", e, g)
|
t.Errorf("The first Cell have a bad Encryption!\n %s is expected and we have %s", e, g)
|
||||||
}
|
}
|
||||||
|
|
||||||
if g, e := wifi.Cells[2].Encryption, "psk"; g != e {
|
if g, e := wifi.Cells[2].Encryption, "psk2"; g != e {
|
||||||
t.Errorf("The last Cell have a bad Encryption!\n %s is expected and we have %s", e, g)
|
t.Errorf("The last Cell have a bad Encryption!\n %s is expected and we have %s", e, g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue