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:
Wouter R
2013-07-17 23:01:01 +02:00
parent d3e4812cbf
commit f988c13dfa
13 changed files with 213 additions and 103 deletions
+10 -2
View File
@@ -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()
+1
View File
@@ -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
+39
View File
@@ -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