mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-20 01:50:04 +00:00
add test cli for genpwd
This commit is contained in:
parent
3b9ff8c15c
commit
01831c1f2b
1 changed files with 25 additions and 0 deletions
|
@ -197,4 +197,29 @@ class TestConfig < Test::Unit::TestCase
|
|||
assert_match(/password_#{k}.+\| true/, output)
|
||||
end
|
||||
end
|
||||
|
||||
def test_07_generate_password
|
||||
length = 24
|
||||
|
||||
output = %x(
|
||||
mpw genpwd \
|
||||
--length #{length} \
|
||||
--alpha
|
||||
)
|
||||
assert_match(/[a-zA-Z]{#{length}}/, output)
|
||||
|
||||
output = %x(
|
||||
mpw genpwd \
|
||||
--length #{length} \
|
||||
--numeric
|
||||
)
|
||||
assert_match(/[0-9]{#{length}}/, output)
|
||||
|
||||
output = %x(
|
||||
mpw genpwd \
|
||||
--length #{length} \
|
||||
--special-chars
|
||||
)
|
||||
assert_no_match(/[a-zA-Z0-9]/, output)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue