mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-19 17:40:05 +00:00
unittest: add remove tests
This commit is contained in:
parent
60d7e9ef8e
commit
e7c03269a6
1 changed files with 20 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
# File: tc_simple_number.rb
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require_relative '../lib/MPW'
|
||||
require 'test/unit'
|
||||
|
@ -201,4 +201,23 @@ class TestMPW < Test::Unit::TestCase
|
|||
assert_equal(@fixtures['update']['port'].to_i, result['port'])
|
||||
assert_equal(@fixtures['update']['comment'], result['comment'])
|
||||
end
|
||||
|
||||
def test_remove
|
||||
assert(@mpw.import(@fixture_file, :yaml))
|
||||
assert_equal(2, @mpw.search.length)
|
||||
|
||||
id = @mpw.search[0]['id']
|
||||
assert(@mpw.remove(id))
|
||||
|
||||
assert_equal(1, @mpw.search.length)
|
||||
end
|
||||
|
||||
def test_remove_noexistent
|
||||
assert(@mpw.import(@fixture_file, :yaml))
|
||||
assert_equal(2, @mpw.search.length)
|
||||
|
||||
assert(!@mpw.remove('TEST_NOEXISTENT_ID'))
|
||||
|
||||
assert_equal(2, @mpw.search.length)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue