Cleanning test data
This commit is contained in:
parent
e08dcc04d5
commit
2c218b00e1
|
@ -1 +0,0 @@
|
|||
00:25:9c:14:59:6d
|
|
@ -1,6 +1,9 @@
|
|||
package owrt
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -29,12 +32,24 @@ func TestGetSysDevName(t *testing.T) {
|
|||
iface.Encryption = ifaceEnc
|
||||
iface.Key = ifaceKey
|
||||
|
||||
if g, e := iface.GetSysDevName("testdata/sys/"), "wlan1"; g != e {
|
||||
testDirectory := "/tmp/sys/devices/platform/soc/soc:pcie/pci0000:00/0000:00:02.0/0000:02:00.0/net/wlan1/"
|
||||
if err := os.MkdirAll(testDirectory, os.ModePerm); err != nil {
|
||||
t.Fatalf("Impossible to setup test directory with test file")
|
||||
}
|
||||
|
||||
testFile := fmt.Sprintf("%s/address", testDirectory)
|
||||
d1 := []byte("00:00:00:84:00:63\n")
|
||||
err := ioutil.WriteFile(testFile, d1, 0644)
|
||||
if err != nil {
|
||||
t.Fatalf("Impossible to setup test directory with test file")
|
||||
}
|
||||
|
||||
if g, e := iface.GetSysDevName("/tmp/sys/"), "wlan1"; g != e {
|
||||
t.Fatalf("UCIWirelessInterface.GetDeviceSysName() failed ! Got: %s Expect: %s", g, e)
|
||||
}
|
||||
|
||||
iface.SysDevName = "wlanX"
|
||||
if g, e := iface.GetSysDevName("testdata/sys/"), "wlanX"; g != e {
|
||||
if g, e := iface.GetSysDevName("/tmp/sys/"), "wlanX"; g != e {
|
||||
t.Fatalf("UCIWirelessInterface.GetDeviceSysName() failed ! Got: %s Expect: %s", g, e)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue