server/scripts/tests/faction.lua
Enno Rehling 6438d6807e accepting Don's changes to the setup script.
back-filling test for faction.get and get_faction.
2014-11-26 18:37:07 +01:00

28 lines
601 B
Lua

module ('tests.eressea.faction', package.seeall, lunit.testcase)
local f
function setup()
conf = [[{
"races": {
"human" : {}
}
}]]
eressea.config.reset()
assert(eressea.config.parse(conf)==0)
f = faction.create("faction@eressea.de", "human", "de")
end
function test_faction_flags()
assert_equal(0, f.flags)
f.flags = 42
assert_equal(42, f.flags)
end
function test_get_faction()
assert_equal(f, get_faction(f.id))
assert_equal(f, faction.get(f.id))
local nf = f.id
if nf>1 then nf = nf - 1 else nf = 1 end
assert_equal(nil, faction.get(nf))
end