1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-02-20 01:50:04 +00:00

add unit test

This commit is contained in:
Adrien Waksberg 2017-02-26 09:45:19 +01:00
parent 000bc3aaa5
commit a737ee94d1

View file

@ -27,7 +27,7 @@ class TestConfig < Test::Unit::TestCase
}
@config = MPW::Config.new
@config.setup(data[:key], data[:lang], data[:wallet_dir], nil, data[:gpg_exe])
@config.setup(data)
@config.load_config
data.each do |k,v|
@ -37,4 +37,28 @@ class TestConfig < Test::Unit::TestCase
@config.setup_gpg_key('password', 'test@example.com', 2048)
assert(@config.check_gpg_key?)
end
def test_01_password
data = { password: { alpha: false,
numeric: false,
special: true,
length: 32,
}
}
@config.load_config
assert_equal(@config.password[:length], 16)
assert(@config.password[:alpha])
assert(@config.password[:numeric])
assert(!@config.password[:special])
@config.setup(data)
@config.load_config
assert_equal(@config.password[:length], 32)
assert(!@config.password[:alpha])
assert(!@config.password[:numeric])
assert(@config.password[:special])
end
end