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

feat: major change the url storage

This commit is contained in:
Adrien Waksberg 2017-09-05 22:16:37 +02:00
parent cf5b7e0142
commit 8b5c7ae581
15 changed files with 87 additions and 145 deletions

View file

@ -48,22 +48,10 @@ OptionParser.new do |opts|
exit 0 exit 0
end end
opts.on('-H', '--host HOST', I18n.t('option.host')) do |host|
values[:host] = host
end
opts.on('-o', '--otp-code CODE', I18n.t('option.otp_code')) do |otp| opts.on('-o', '--otp-code CODE', I18n.t('option.otp_code')) do |otp|
values[:otp_key] = otp values[:otp_key] = otp
end end
opts.on('-O', '--protocol PROTOCOL', I18n.t('option.protocol')) do |protocol|
values[:protocol] = protocol
end
opts.on('-P', '--port NUMBER', I18n.t('option.port')) do |port|
values[:port] = port
end
opts.on('-r', '--random', I18n.t('option.random_password')) do opts.on('-r', '--random', I18n.t('option.random_password')) do
options[:password] = true options[:password] = true
end end
@ -72,7 +60,11 @@ OptionParser.new do |opts|
options[:text_editor] = true options[:text_editor] = true
end end
opts.on('-u', '--user USER', I18n.t('option.user')) do |user| opts.on('-u', '--url URL', I18n.t('option.url')) do |url|
values[:url] = url
end
opts.on('-U', '--user USER', I18n.t('option.user')) do |user|
values[:user] = user values[:user] = user
end end

View file

@ -53,26 +53,14 @@ OptionParser.new do |opts|
exit 0 exit 0
end end
opts.on('-H', '--host HOST', I18n.t('option.host')) do |host|
values[:host] = host
end
opts.on('-o', '--otp-code CODE', I18n.t('option.otp_code')) do |otp| opts.on('-o', '--otp-code CODE', I18n.t('option.otp_code')) do |otp|
values[:otp_key] = otp values[:otp_key] = otp
end end
opts.on('-O', '--protocol PROTOCOL', I18n.t('option.protocol')) do |protocol|
values[:protocol] = protocol
end
opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern| opts.on('-p', '--pattern PATTERN', I18n.t('option.pattern')) do |pattern|
search[:pattern] = pattern search[:pattern] = pattern
end end
opts.on('-P', '--port NUMBER', I18n.t('option.port')) do |port|
values[:port] = port
end
opts.on('-r', '--random', I18n.t('option.random_password')) do opts.on('-r', '--random', I18n.t('option.random_password')) do
options[:password] = true options[:password] = true
end end
@ -81,7 +69,11 @@ OptionParser.new do |opts|
options[:text_editor] = true options[:text_editor] = true
end end
opts.on('-u', '--user USER', I18n.t('option.user')) do |user| opts.on('-u', '--url URL', I18n.t('option.url')) do |url|
values[:url] = url
end
opts.on('-U', '--user USER', I18n.t('option.user')) do |user|
values[:user] = user values[:user] = user
end end

View file

@ -63,7 +63,6 @@ en:
gpg_key: "Specify a GPG key (ex: user@example.com)" gpg_key: "Specify a GPG key (ex: user@example.com)"
group: "Search the items with specified group" group: "Search the items with specified group"
help: "Show this help message" help: "Show this help message"
host: "Specify a host or ip"
init: "Initialize mpw" init: "Initialize mpw"
import: "Import item from an yaml file" import: "Import item from an yaml file"
key: "Define the key name" key: "Define the key name"
@ -77,8 +76,6 @@ en:
path: "Move the wallet in new specify directory" path: "Move the wallet in new specify directory"
pattern: "Given search pattern" pattern: "Given search pattern"
pinmode: "Enable pinentry mode (available with gpg >= 2.1)" pinmode: "Enable pinentry mode (available with gpg >= 2.1)"
port: "Set a port of connexion"
protocol: "Set a protocol of connexion"
random_password: "Generate a random password" random_password: "Generate a random password"
setup: "Create a new configuration file" setup: "Create a new configuration file"
setup_wallet: "Create a new configuration file for a wallet" setup_wallet: "Create a new configuration file for a wallet"
@ -87,6 +84,7 @@ en:
show_all: "Listing all items" show_all: "Listing all items"
text_editor: "Use text editor to edit the item" text_editor: "Use text editor to edit the item"
usage: "Use" usage: "Use"
url: "Set an url (ex: https://example.com/path)"
user: "Set an user" user: "Set an user"
wallet: "Specify a wallet to use" wallet: "Specify a wallet to use"
wallet_dir: "Set the wallets folder" wallet_dir: "Set the wallets folder"

View file

@ -63,7 +63,6 @@ fr:
gpg_key: "Spécifie une clé GPG (ex: user@example.com)" gpg_key: "Spécifie une clé GPG (ex: user@example.com)"
group: "Recherche les éléments appartenant au groupe spécifié" group: "Recherche les éléments appartenant au groupe spécifié"
help: "Affiche ce message d'aide" help: "Affiche ce message d'aide"
host: "Spécifie le nom du serveur ou l'ip"
import: "Importe des éléments depuis un fichier yaml" import: "Importe des éléments depuis un fichier yaml"
init: "Initialise mpw" init: "Initialise mpw"
key: "Spécifie le nom d'une clé" key: "Spécifie le nom d'une clé"
@ -77,8 +76,6 @@ fr:
path: "Déplace le portefeuille dans un nouveau dossier" path: "Déplace le portefeuille dans un nouveau dossier"
pattern: "Motif de donnée à chercher" pattern: "Motif de donnée à chercher"
pinmode: "Active le mode pinentry (valable avec gpg >= 2.1)" pinmode: "Active le mode pinentry (valable avec gpg >= 2.1)"
port: "Spécifie un port de connexion"
protocol: "Spécifie un protocol de connexion"
random_password: "Génére un mot de passe aléatoire" random_password: "Génére un mot de passe aléatoire"
setup: "Création d'un nouveau fichier de configuration" setup: "Création d'un nouveau fichier de configuration"
setup_wallet: "Création d'un nouveau fichier de configuration pour un portefeuille" setup_wallet: "Création d'un nouveau fichier de configuration pour un portefeuille"
@ -87,6 +84,7 @@ fr:
show_all: "Liste tous les éléments" show_all: "Liste tous les éléments"
text_editor: "Active l'édition avec un éditeur de texte" text_editor: "Active l'édition avec un éditeur de texte"
usage: "Utilisation" usage: "Utilisation"
url: "Spécifie l'url (ex: http://example.com/path)"
user: "Spécifie un utilisateur" user: "Spécifie un utilisateur"
wallet: "Spécifie le portefeuille à utiliser" wallet: "Spécifie le portefeuille à utiliser"
wallet_dir: "Spécifie le répertoire des portefeuilles" wallet_dir: "Spécifie le répertoire des portefeuilles"

View file

@ -563,16 +563,14 @@ module MPW
items.each do |item| items.each do |item|
data.merge!( data.merge!(
item.id => { item.id => {
'host' => item.host,
'user' => item.user,
'group' => item.group,
'password' => @mpw.get_password(item.id),
'protocol' => item.protocol,
'port' => item.port,
'otp_key' => @mpw.get_otp_key(item.id),
'comment' => item.comment, 'comment' => item.comment,
'last_edit' => item.last_edit,
'created' => item.created, 'created' => item.created,
'group' => item.group,
'last_edit' => item.last_edit,
'otp_key' => @mpw.get_otp_key(item.id),
'password' => @mpw.get_password(item.id),
'url' => item.url,
'user' => item.user
} }
) )
end end
@ -599,12 +597,10 @@ module MPW
Import.send(format, file).each_value do |row| Import.send(format, file).each_value do |row|
item = Item.new( item = Item.new(
comment: row['comment'],
group: row['group'], group: row['group'],
host: row['host'], url: row['url'],
protocol: row['protocol'], user: row['user']
user: row['user'],
port: row['port'],
comment: row['comment']
) )
next if item.empty? next if item.empty?

View file

@ -37,18 +37,12 @@ module MPW
end end
data[id] = { data[id] = {
'comment' => comment,
'group' => row['group'], 'group' => row['group'],
'host' => row['url'],
'user' => row['user'],
'password' => row['password'], 'password' => row['password'],
'comment' => comment 'url' => row['url'],
'user' => row['user']
} }
if row['url'] =~ %r{^((?<protocol>[a-z]+)://)?(?<host>[a-zA-Z0-9_.-]+)(:(?<port>[0-9]{1,5}))?$}
data[id]['protocol'] = Regexp.last_match(:protocol)
data[id]['port'] = Regexp.last_match(:port)
data[id]['host'] = Regexp.last_match(:host)
end
end end
data data

View file

@ -17,25 +17,27 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'i18n' require 'i18n'
require 'uri'
module MPW module MPW
class Item class Item
attr_accessor :id attr_accessor :created
attr_accessor :comment
attr_accessor :group attr_accessor :group
attr_accessor :host attr_accessor :host
attr_accessor :protocol attr_accessor :id
attr_accessor :user
attr_accessor :port
attr_accessor :otp attr_accessor :otp
attr_accessor :comment attr_accessor :port
attr_accessor :protocol
attr_accessor :last_edit attr_accessor :last_edit
attr_accessor :created attr_accessor :url
attr_accessor :user
# @param options [Hash] the option :host is required # @param options [Hash] the option :host is required
def initialize(**options) def initialize(**options)
@host = '' @host = ''
if !options.key?(:id) || options[:id].to_s.empty? || !options.key?(:created) || options[:created].to_s.empty? if !options[:id] || !options[:created]
@id = generate_id @id = generate_id
@created = Time.now.to_i @created = Time.now.to_i
else else
@ -51,43 +53,38 @@ module MPW
# Update the item # Update the item
# @param options [Hash] # @param options [Hash]
def update(**options) def update(**options)
unless options[:host] || options[:comment] unless options[:url] || options[:comment]
raise I18n.t('error.update.host_and_comment_empty') raise I18n.t('error.update.host_and_comment_empty')
end end
@group = options[:group] if options.key?(:group) if options[:url]
@host = options[:host] if options.key?(:host) && !options[:host].nil? uri = URI(options[:url])
@protocol = options[:protocol] if options.key?(:protocol) @host = uri.host || options[:url]
@user = options[:user] if options.key?(:user) @port = uri.port || nil
@port = options[:port].to_i if options.key?(:port) && !options[:port].to_s.empty? @protocol = uri.scheme || nil
@otp = options[:otp] if options.key?(:otp) @url = options[:url]
@comment = options[:comment] if options.key?(:comment) end
@last_edit = Time.now.to_i unless options.key?(:no_update_last_edit)
@comment = options[:comment] if options.key?(:comment)
@group = options[:group] if options.key?(:group)
@last_edit = Time.now.to_i unless options.key?(:no_update_last_edit)
@otp = options[:otp] if options.key?(:otp)
@user = options[:user] if options.key?(:user)
end end
# Delete all data # Delete all data
def delete def delete
@id = nil @id = nil
@group = nil
@host = nil
@protocol = nil
@user = nil
@port = nil
@otp = nil
@comment = nil @comment = nil
@created = nil @created = nil
@group = nil
@host = nil
@last_edit = nil @last_edit = nil
end @otp = nil
@port = nil
# Return data on url format @protocol = nil
# @return [String] an url @url = nil
def url @user = nil
url = ''
url += "#{@protocol}://" if @protocol
url += @host if @host
url += ":#{@port}" if @port
url
end end
def empty? def empty?

View file

@ -84,10 +84,8 @@ module MPW
Item.new( Item.new(
id: d['id'], id: d['id'],
group: d['group'], group: d['group'],
host: d['host'],
protocol: d['protocol'],
user: d['user'], user: d['user'],
port: d['port'], url: d['url'],
otp: @otp_keys.key?(d['id']), otp: @otp_keys.key?(d['id']),
comment: d['comment'], comment: d['comment'],
last_edit: d['last_edit'], last_edit: d['last_edit'],
@ -114,10 +112,8 @@ module MPW
item.id => { item.id => {
'id' => item.id, 'id' => item.id,
'group' => item.group, 'group' => item.group,
'host' => item.host,
'protocol' => item.protocol,
'user' => item.user, 'user' => item.user,
'port' => item.port, 'url' => item.url,
'comment' => item.comment, 'comment' => item.comment,
'last_edit' => item.last_edit, 'last_edit' => item.last_edit,
'created' => item.created, 'created' => item.created,

View file

@ -1,16 +1,12 @@
--- ---
# <%= I18n.t('form.add_item.host') %> # <%= I18n.t('form.add_item.url') %>
host: <%= options[:host] %> url: <%= options[:url] %>
# <%= I18n.t('form.add_item.login') %> # <%= I18n.t('form.add_item.login') %>
user: <%= options[:user] %> user: <%= options[:user] %>
# <%= I18n.t('form.add_item.group') %> # <%= I18n.t('form.add_item.group') %>
group: <%= options[:group] %> group: <%= options[:group] %><% unless password %>
# <%= I18n.t('form.add_item.protocol') %>
protocol: <%= options[:protocol] %><% unless password %>
# <%= I18n.t('form.add_item.password') %> # <%= I18n.t('form.add_item.password') %>
password:<% end %> password:<% end %>
# <%= I18n.t('form.add_item.port') %>
port: <%= options[:port] %>
# <%= I18n.t('form.add_item.comment') %> # <%= I18n.t('form.add_item.comment') %>
comment: <%= options[:comment] %> comment: <%= options[:comment] %>
# <%= I18n.t('form.add_item.otp_key') %> # <%= I18n.t('form.add_item.otp_key') %>

View file

@ -1,16 +1,12 @@
--- ---
# <%= I18n.t('form.update_item.host') %> # <%= I18n.t('form.update_item.url') %>
host: <% if options[:host] %><%= options[:host] %><% else %><%= item.host %><% end %> host: <% if options[:url] %><%= options[:url] %><% else %><%= item.url %><% end %>
# <%= I18n.t('form.update_item.login') %> # <%= I18n.t('form.update_item.login') %>
user: <% if options[:user] %><%= options[:user] %><% else %><%= item.user %><% end %><% unless password %> user: <% if options[:user] %><%= options[:user] %><% else %><%= item.user %><% end %><% unless password %>
# <%= I18n.t('form.update_item.password') %> # <%= I18n.t('form.update_item.password') %>
password: <% end %> password: <% end %>
# <%= I18n.t('form.update_item.group') %> # <%= I18n.t('form.update_item.group') %>
group: <% if options[:group] %><%= options[:group] %><% else %><%= item.group %><% end %> group: <% if options[:group] %><%= options[:group] %><% else %><%= item.group %><% end %>
# <%= I18n.t('form.update_item.protocol') %>
protocol: <% if options[:protocol] %><%= options[:protocol] %><% else %><%= item.protocol %><% end %>
# <%= I18n.t('form.update_item.port') %>
port: <% if options[:port] %><%= options[:port] %><% else %><%= item.port %><% end %>
# <%= I18n.t('form.update_item.otp_key') %> # <%= I18n.t('form.update_item.otp_key') %>
otp_key: <% if options[:otp_key] %><%= options[:otp_key] %><% end %> otp_key: <% if options[:otp_key] %><%= options[:otp_key] %><% end %>
# <%= I18n.t('form.update_item.comment') %> # <%= I18n.t('form.update_item.comment') %>

View file

@ -1,19 +1,16 @@
--- ---
1: 1:
host: fric.com url: https://fric.com
user: 230403 user: 230403
group: Bank group: Bank
password: 5XdiTQOubRDw9B0aJoMlcEyL password: 5XdiTQOubRDw9B0aJoMlcEyL
protocol: https
port:
otp_key: 330223432 otp_key: 330223432
comment: I love my bank comment: I love my bank
2: 2:
host: assurance.com url: https://assurance.com:443
user: user_2132 user: user_2132
host: assurance.com
group: Assurance group: Assurance
password: DMyK6B3v4bWO52VzU7aTHIem password: DMyK6B3v4bWO52VzU7aTHIem
protocol: https
port: 443
otp_key: otp_key:
comment: comment:

View file

@ -1,4 +1,5 @@
add: add:
url: 'https://example.com:8080'
group: 'Bank' group: 'Bank'
host: 'example.com' host: 'example.com'
protocol: 'https' protocol: 'https'
@ -9,6 +10,7 @@ add:
import: import:
id: 'TEST-ID-XXXXX' id: 'TEST-ID-XXXXX'
url: 'https://gogole.com:8081/toto'
group: 'Cloud' group: 'Cloud'
host: 'gogole.com' host: 'gogole.com'
protocol: 'https' protocol: 'https'
@ -19,6 +21,7 @@ import:
created: 1386752948 created: 1386752948
update: update:
url: 'ssh://example2.com:2222'
group: 'Assurance' group: 'Assurance'
host: 'example2.com' host: 'example2.com'
protocol: 'ssh' protocol: 'ssh'

View file

@ -29,9 +29,7 @@ class TestConfig < Test::Unit::TestCase
output = %x( output = %x(
echo #{@password} | mpw add \ echo #{@password} | mpw add \
--host #{data['host']} \ --url #{data['url']} \
--port #{data['port']} \
--protocol #{data['protocol']} \
--user #{data['user']} \ --user #{data['user']} \
--comment '#{data['comment']}' \ --comment '#{data['comment']}' \
--group #{data['group']} \ --group #{data['group']} \
@ -73,9 +71,7 @@ class TestConfig < Test::Unit::TestCase
output = %x( output = %x(
echo #{@password} | mpw update \ echo #{@password} | mpw update \
-p #{@fixtures['add']['host']} \ -p #{@fixtures['add']['host']} \
--host #{data['host']} \ --url #{data['url']} \
--port #{data['port']} \
--protocol #{data['protocol']} \
--user #{data['user']} \ --user #{data['user']} \
--comment '#{data['comment']}' \ --comment '#{data['comment']}' \
--new-group #{data['group']} --new-group #{data['group']}
@ -117,20 +113,22 @@ class TestConfig < Test::Unit::TestCase
error = true error = true
YAML.load_file(file_export).each_value do |export| YAML.load_file(file_export).each_value do |export|
next if import['host'] != export['host'] next if import['url'] != export['url']
%w[user group password protocol port otp_key comment].each do |key| %w[user group password protocol port otp_key comment].each do |key|
assert_equal(import[key].to_s, export[key].to_s) assert_equal(import[key].to_s, export[key].to_s)
end end
error = false error = false
break
end end
assert(!error) assert(!error)
end end
end end
def test_06_copy def test_06_copy
data = YAML.load_file('./test/files/fixtures-import.yml')[1] data = YAML.load_file('./test/files/fixtures-import.yml')[2]
output = %x( output = %x(
echo "#{@password}\np\nq" | mpw copy \ echo "#{@password}\np\nq" | mpw copy \

View file

@ -23,10 +23,8 @@ class TestItem < Test::Unit::TestCase
def test_01_add def test_01_add
data = { data = {
group: @fixtures['add']['group'], group: @fixtures['add']['group'],
host: @fixtures['add']['host'],
protocol: @fixtures['add']['protocol'],
user: @fixtures['add']['user'], user: @fixtures['add']['user'],
port: @fixtures['add']['port'], url: @fixtures['add']['url'],
comment: @fixtures['add']['comment'] comment: @fixtures['add']['comment']
} }
@ -35,6 +33,7 @@ class TestItem < Test::Unit::TestCase
assert(!item.nil?) assert(!item.nil?)
assert(!item.empty?) assert(!item.empty?)
assert_equal(@fixtures['add']['url'], item.url)
assert_equal(@fixtures['add']['group'], item.group) assert_equal(@fixtures['add']['group'], item.group)
assert_equal(@fixtures['add']['host'], item.host) assert_equal(@fixtures['add']['host'], item.host)
assert_equal(@fixtures['add']['protocol'], item.protocol) assert_equal(@fixtures['add']['protocol'], item.protocol)
@ -47,10 +46,8 @@ class TestItem < Test::Unit::TestCase
data = { data = {
id: @fixtures['import']['id'], id: @fixtures['import']['id'],
group: @fixtures['import']['group'], group: @fixtures['import']['group'],
host: @fixtures['import']['host'],
protocol: @fixtures['import']['protocol'],
user: @fixtures['import']['user'], user: @fixtures['import']['user'],
port: @fixtures['import']['port'], url: @fixtures['import']['url'],
comment: @fixtures['import']['comment'], comment: @fixtures['import']['comment'],
created: @fixtures['import']['created'] created: @fixtures['import']['created']
} }
@ -61,6 +58,7 @@ class TestItem < Test::Unit::TestCase
assert(!item.empty?) assert(!item.empty?)
assert_equal(@fixtures['import']['id'], item.id) assert_equal(@fixtures['import']['id'], item.id)
assert_equal(@fixtures['import']['url'], item.url)
assert_equal(@fixtures['import']['group'], item.group) assert_equal(@fixtures['import']['group'], item.group)
assert_equal(@fixtures['import']['host'], item.host) assert_equal(@fixtures['import']['host'], item.host)
assert_equal(@fixtures['import']['protocol'], item.protocol) assert_equal(@fixtures['import']['protocol'], item.protocol)
@ -73,10 +71,8 @@ class TestItem < Test::Unit::TestCase
def test_03_update def test_03_update
data = { data = {
group: @fixtures['add']['group'], group: @fixtures['add']['group'],
host: @fixtures['add']['host'],
protocol: @fixtures['add']['protocol'],
user: @fixtures['add']['user'], user: @fixtures['add']['user'],
port: @fixtures['add']['port'], url: @fixtures['add']['url'],
comment: @fixtures['add']['comment'] comment: @fixtures['add']['comment']
} }
@ -90,10 +86,8 @@ class TestItem < Test::Unit::TestCase
data = { data = {
group: @fixtures['update']['group'], group: @fixtures['update']['group'],
host: @fixtures['update']['host'],
protocol: @fixtures['update']['protocol'],
user: @fixtures['update']['user'], user: @fixtures['update']['user'],
port: @fixtures['update']['port'], url: @fixtures['update']['url'],
comment: @fixtures['update']['comment'] comment: @fixtures['update']['comment']
} }
@ -102,6 +96,7 @@ class TestItem < Test::Unit::TestCase
assert(!item.empty?) assert(!item.empty?)
assert_equal(@fixtures['update']['url'], item.url)
assert_equal(@fixtures['update']['group'], item.group) assert_equal(@fixtures['update']['group'], item.group)
assert_equal(@fixtures['update']['host'], item.host) assert_equal(@fixtures['update']['host'], item.host)
assert_equal(@fixtures['update']['protocol'], item.protocol) assert_equal(@fixtures['update']['protocol'], item.protocol)
@ -116,10 +111,8 @@ class TestItem < Test::Unit::TestCase
def test_05_update_one_element def test_05_update_one_element
data = { data = {
group: @fixtures['add']['group'], group: @fixtures['add']['group'],
host: @fixtures['add']['host'],
protocol: @fixtures['add']['protocol'],
user: @fixtures['add']['user'], user: @fixtures['add']['user'],
port: @fixtures['add']['port'], url: @fixtures['add']['url'],
comment: @fixtures['add']['comment'] comment: @fixtures['add']['comment']
} }
@ -131,8 +124,9 @@ class TestItem < Test::Unit::TestCase
last_edit = item.last_edit last_edit = item.last_edit
sleep(1) sleep(1)
assert(item.update(comment: @fixtures['update']['comment'])) item.update(comment: @fixtures['update']['comment'])
assert_equal(@fixtures['add']['url'], item.url)
assert_equal(@fixtures['add']['group'], item.group) assert_equal(@fixtures['add']['group'], item.group)
assert_equal(@fixtures['add']['host'], item.host) assert_equal(@fixtures['add']['host'], item.host)
assert_equal(@fixtures['add']['protocol'], item.protocol) assert_equal(@fixtures['add']['protocol'], item.protocol)
@ -146,10 +140,8 @@ class TestItem < Test::Unit::TestCase
def test_05_delete def test_05_delete
data = { data = {
group: @fixtures['add']['group'], group: @fixtures['add']['group'],
host: @fixtures['add']['host'],
protocol: @fixtures['add']['protocol'],
user: @fixtures['add']['user'], user: @fixtures['add']['user'],
port: @fixtures['add']['port'], url: @fixtures['add']['url'],
comment: @fixtures['add']['comment'] comment: @fixtures['add']['comment']
} }
@ -163,6 +155,7 @@ class TestItem < Test::Unit::TestCase
assert(item.empty?) assert(item.empty?)
assert_equal(nil, item.id) assert_equal(nil, item.id)
assert_equal(nil, item.url)
assert_equal(nil, item.group) assert_equal(nil, item.group)
assert_equal(nil, item.host) assert_equal(nil, item.host)
assert_equal(nil, item.protocol) assert_equal(nil, item.protocol)

View file

@ -33,10 +33,8 @@ class TestMPW < Test::Unit::TestCase
def test_02_add_item def test_02_add_item
data = { data = {
group: @fixtures['add']['group'], group: @fixtures['add']['group'],
host: @fixtures['add']['host'],
protocol: @fixtures['add']['protocol'],
user: @fixtures['add']['user'], user: @fixtures['add']['user'],
port: @fixtures['add']['port'], url: @fixtures['add']['url'],
comment: @fixtures['add']['comment'] comment: @fixtures['add']['comment']
} }
@ -93,10 +91,8 @@ class TestMPW < Test::Unit::TestCase
@fixtures.each_value do |v| @fixtures.each_value do |v|
data = { data = {
group: v['group'], group: v['group'],
host: v['host'],
protocol: v['protocol'],
user: v['user'], user: v['user'],
port: v['port'], url: v['url'],
comment: v['comment'] comment: v['comment']
} }