mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2026-09-08 00:44:46 +02:00
Many changes, mostly a new configuration interface:
* change API access control to use function name suffixes * implement settings interface with baseline configuration * make AP properties configurable * AP SSID can now contain partial MAC address * update more quotation style and documentation * remove captive directory change from network mode switcher.
This commit is contained in:
@@ -35,8 +35,8 @@ function M:test_get()
|
||||
end
|
||||
|
||||
function M:test_set()
|
||||
local key = 'apAddress'
|
||||
local goodValue, badValue1, badValue2 = '10.0.0.1', '10.00.1', '10.0.0d.1'
|
||||
local key, intKey = 'apAddress', 'temperature'
|
||||
local intValue, goodValue, badValue1, badValue2 = 340, '10.0.0.1', '10.00.1', '10.0.0d.1'
|
||||
|
||||
assert(s.get(key) == defaults.apAddress.default)
|
||||
assert(s.isDefault(key))
|
||||
@@ -53,6 +53,14 @@ function M:test_set()
|
||||
|
||||
assert(s.set(key, nil))
|
||||
assert(s.isDefault(key))
|
||||
|
||||
-- test with value of int type
|
||||
assert(s.get(intKey) == defaults.temperature.default)
|
||||
assert(s.isDefault(intKey))
|
||||
|
||||
assert(s.set(intKey, intValue))
|
||||
assert(s.get(intKey) == intValue)
|
||||
assert(not s.isDefault(intKey))
|
||||
end
|
||||
|
||||
function M:test_setNonExistent()
|
||||
|
||||
@@ -98,6 +98,7 @@ function M:test_symlink()
|
||||
assert(false, 'not implemented')
|
||||
end
|
||||
|
||||
-- this should test for the following condition: 'Could not rename /www to /www-regular(/www: Invalid cross-device link)'
|
||||
function M:test_symlinkInRoot()
|
||||
assert(false, 'not implemented')
|
||||
end
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
local wlanconfig = require("network.wlanconfig")
|
||||
|
||||
local M = {
|
||||
_is_test = true,
|
||||
_skip = {},
|
||||
_wifibox_only = {}
|
||||
}
|
||||
|
||||
local function captureCommandOutput(cmd)
|
||||
local f = assert(io.popen(cmd, 'r'))
|
||||
return assert(f:read('*all'))
|
||||
end
|
||||
|
||||
function M._setup()
|
||||
wlanconfig.init()
|
||||
end
|
||||
|
||||
function M.test_getMacAddress()
|
||||
local reportedMac = wlanconfig.getMacAddress()
|
||||
local output = captureCommandOutput('ifconfig wlan0')
|
||||
local actualMac = output:match('HWaddr (%w%w:%w%w:%w%w:%w%w:%w%w:%w%w)'):gsub(':', ''):upper()
|
||||
|
||||
assert(reportedMac == actualMac)
|
||||
end
|
||||
|
||||
function M.test_getSubstitutedSsid()
|
||||
local mac = wlanconfig.getMacAddress()
|
||||
local macTail = mac:sub(7)
|
||||
|
||||
local expected1 = 'pre' .. macTail .. 'post'
|
||||
local expected2 = 'pre' .. macTail .. 'post-cache-test'
|
||||
|
||||
assert(wlanconfig.getSubstitutedSsid('pre%%MAC_ADDR_TAIL%%post') == expected1)
|
||||
assert(wlanconfig.getSubstitutedSsid('pre%%MAC_ADDR_TAIL%%post-cache-test') == expected2)
|
||||
assert(wlanconfig.getSubstitutedSsid('pre%%MAC_ADDR_TAIL%%post') == expected1)
|
||||
assert(wlanconfig.getSubstitutedSsid('pre%%MAC_ADDR_TAIL%%post') == expected1)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user