1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-10-27 02:33:19 +00:00

fix syntax for all tests

This commit is contained in:
Adrien Waksberg 2017-05-11 22:24:05 +02:00
parent 977266def8
commit f150feec10
5 changed files with 85 additions and 81 deletions

View file

@ -3,7 +3,6 @@ AllCops:
Exclude:
- db/**/*
- config/**/*
- test/*
- Vagrantfile
TargetRubyVersion: 2.3

View file

@ -20,10 +20,11 @@ class TestConfig < Test::Unit::TestCase
end
def test_00_config
data = { gpg_key: 'test@example.com',
data = {
gpg_key: 'test@example.com',
lang: 'en',
wallet_dir: '/tmp/test',
gpg_exe: '',
gpg_exe: ''
}
@config = MPW::Config.new
@ -39,10 +40,11 @@ class TestConfig < Test::Unit::TestCase
end
def test_01_password
data = { pwd_alpha: false,
data = {
pwd_alpha: false,
pwd_numeric: false,
pwd_special: true,
pwd_length: 32,
pwd_length: 32
}
@config = MPW::Config.new

View file

@ -16,7 +16,6 @@ class TestItem < Test::Unit::TestCase
I18n.load_path = Dir['./i18n/cli/*.yml']
I18n.default_locale = :en
puts
end
@ -25,12 +24,13 @@ class TestItem < Test::Unit::TestCase
end
def test_01_add_new
data = { group: @fixtures['add_new']['group'],
data = {
group: @fixtures['add_new']['group'],
host: @fixtures['add_new']['host'],
protocol: @fixtures['add_new']['protocol'],
user: @fixtures['add_new']['user'],
port: @fixtures['add_new']['port'],
comment: @fixtures['add_new']['comment'],
comment: @fixtures['add_new']['comment']
}
item = MPW::Item.new(data)
@ -47,14 +47,15 @@ class TestItem < Test::Unit::TestCase
end
def test_02_add_existing
data = { id: @fixtures['add_existing']['id'],
data = {
id: @fixtures['add_existing']['id'],
group: @fixtures['add_existing']['group'],
host: @fixtures['add_existing']['host'],
protocol: @fixtures['add_existing']['protocol'],
user: @fixtures['add_existing']['user'],
port: @fixtures['add_existing']['port'],
comment: @fixtures['add_existing']['comment'],
created: @fixtures['add_existing']['created'],
created: @fixtures['add_existing']['created']
}
item = MPW::Item.new(data)
@ -73,12 +74,13 @@ class TestItem < Test::Unit::TestCase
end
def test_03_update
data = { group: @fixtures['add_new']['group'],
data = {
group: @fixtures['add_new']['group'],
host: @fixtures['add_new']['host'],
protocol: @fixtures['add_new']['protocol'],
user: @fixtures['add_new']['user'],
port: @fixtures['add_new']['port'],
comment: @fixtures['add_new']['comment'],
comment: @fixtures['add_new']['comment']
}
item = MPW::Item.new(data)
@ -89,12 +91,13 @@ class TestItem < Test::Unit::TestCase
created = item.created
last_edit = item.last_edit
data = { group: @fixtures['update']['group'],
data = {
group: @fixtures['update']['group'],
host: @fixtures['update']['host'],
protocol: @fixtures['update']['protocol'],
user: @fixtures['update']['user'],
port: @fixtures['update']['port'],
comment: @fixtures['update']['comment'],
comment: @fixtures['update']['comment']
}
sleep(1)
@ -114,12 +117,13 @@ class TestItem < Test::Unit::TestCase
end
def test_05_update_one_element
data = { group: @fixtures['add_new']['group'],
data = {
group: @fixtures['add_new']['group'],
host: @fixtures['add_new']['host'],
protocol: @fixtures['add_new']['protocol'],
user: @fixtures['add_new']['user'],
port: @fixtures['add_new']['port'],
comment: @fixtures['add_new']['comment'],
comment: @fixtures['add_new']['comment']
}
item = MPW::Item.new(data)
@ -130,7 +134,7 @@ class TestItem < Test::Unit::TestCase
last_edit = item.last_edit
sleep(1)
assert(item.update({comment: @fixtures['update']['comment']}))
assert(item.update(comment: @fixtures['update']['comment']))
assert_equal(@fixtures['add_new']['group'], item.group)
assert_equal(@fixtures['add_new']['host'], item.host)
@ -143,12 +147,13 @@ class TestItem < Test::Unit::TestCase
end
def test_05_delete
data = { group: @fixtures['add_new']['group'],
data = {
group: @fixtures['add_new']['group'],
host: @fixtures['add_new']['host'],
protocol: @fixtures['add_new']['protocol'],
user: @fixtures['add_new']['user'],
port: @fixtures['add_new']['port'],
comment: @fixtures['add_new']['comment'],
comment: @fixtures['add_new']['comment']
}
item = MPW::Item.new(data)

View file

@ -33,12 +33,13 @@ class TestMPW < Test::Unit::TestCase
end
def test_02_add_item
data = { group: @fixtures['add_new']['group'],
data = {
group: @fixtures['add_new']['group'],
host: @fixtures['add_new']['host'],
protocol: @fixtures['add_new']['protocol'],
user: @fixtures['add_new']['user'],
port: @fixtures['add_new']['port'],
comment: @fixtures['add_new']['comment'],
comment: @fixtures['add_new']['comment']
}
item = MPW::Item.new(data)
@ -80,13 +81,9 @@ class TestMPW < Test::Unit::TestCase
def test_04_delete_item
@mpw.read_data
assert_equal(1, @mpw.list.length)
@mpw.list.each do |item|
item.delete
end
@mpw.list.each(&:delete)
assert_equal(0, @mpw.list.length)
@mpw.write_data
@ -96,12 +93,13 @@ class TestMPW < Test::Unit::TestCase
@mpw.read_data
@fixtures.each_value do |v|
data = { group: v['group'],
data = {
group: v['group'],
host: v['host'],
protocol: v['protocol'],
user: v['user'],
port: v['port'],
comment: v['comment'],
comment: v['comment']
}
item = MPW::Item.new(data)

View file

@ -11,7 +11,7 @@ class TestTranslate < Test::Unit::TestCase
lang = File.basename(yaml, '.yml')
translate = YAML.load_file(yaml)
`grep -r -o "I18n.t('.*)" bin/ lib/ | cut -d"'" -f2`.each_line do |line|
%x(grep -r -o "I18n.t('.*)" bin/ lib/ | cut -d"'" -f2).each_line do |line|
begin
t = translate[lang]
line.strip.split('.').each do |v|