syscnf.lua 1.31 KB
Newer Older
1
--[[
2
Copyright 2018, CZ.NIC z.s.p.o. (http://www.nic.cz/)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

This file is part of the turris updater.

Updater is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Updater is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Updater.  If not, see <http://www.gnu.org/licenses/>.
]]--

20 21
require 'lunit'
local SC = require "syscnf"
22

23
module("syscnf-tests", package.seeall, lunit.testcase)
24

25
function test_set_root_dir()
26
	SC.set_root_dir("/dir/")
27 28
	assert_equal("/dir/usr/lib/opkg/status", SC.status_file)
	assert_equal("/dir/usr/lib/opkg/info/", SC.info_dir)
29 30
	assert_equal("/dir/usr/share/updater/unpacked/", SC.pkg_unpacked_dir)
	assert_equal("/dir/usr/share/updater/download/", SC.pkg_download_dir)
31
	assert_equal("/dir/usr/share/updater/collided/", SC.dir_opkg_collided)
32
end
33

34 35 36 37
function test_set_target()
	SC.set_target("Turris", "unknown")
	assert_equal("Turris", SC.target_model)
	assert_equal("unknown", SC.target_board)
38
end