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:
parent
000bc3aaa5
commit
a737ee94d1
1 changed files with 25 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue