mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-20 01:50:04 +00:00
generate a gpg key for the test
This commit is contained in:
parent
b287b719fe
commit
4bd538fa7c
3 changed files with 21 additions and 4 deletions
19
test/init.rb
Normal file
19
test/init.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
require 'gpgme'
|
||||
|
||||
param = ''
|
||||
param << '<GnupgKeyParms format="internal">' + "\n"
|
||||
param << "Key-Type: RSA\n"
|
||||
param << "Key-Length: 2048\n"
|
||||
param << "Subkey-Type: ELG-E\n"
|
||||
param << "Subkey-Length: 2048\n"
|
||||
param << "Name-Real: test\n"
|
||||
param << "Name-Comment: test\n"
|
||||
param << "Name-Email: test2@example.com\n"
|
||||
param << "Expire-Date: 0\n"
|
||||
param << "Passphrase: password\n"
|
||||
param << "</GnupgKeyParms>\n"
|
||||
|
||||
ctx = GPGME::Ctx.new
|
||||
ctx.genkey(param, nil, nil)
|
|
@ -120,9 +120,6 @@ class TestMPW < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_06_add_gpg_key
|
||||
@config = MPW::Config.new
|
||||
@config.setup_gpg_key('password', 'test2@example.com', 2048)
|
||||
|
||||
@mpw.read_data
|
||||
|
||||
@mpw.add_key('test2@example.com')
|
||||
|
@ -131,7 +128,7 @@ class TestMPW < Test::Unit::TestCase
|
|||
@mpw.write_data
|
||||
end
|
||||
|
||||
def test07_delete_gpg_key
|
||||
def test_07_delete_gpg_key
|
||||
@mpw.read_data
|
||||
assert_equal(2, @mpw.keys.length)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
require_relative 'init.rb'
|
||||
require_relative 'test_config.rb'
|
||||
require_relative 'test_item.rb'
|
||||
require_relative 'test_mpw.rb'
|
||||
|
|
Loading…
Add table
Reference in a new issue