Sha256: b0e29841a80f038aad471279189cbd2ddc7e09906d8fe5a1415305efbad6dfc3

Contents?: true

Size: 809 Bytes

Versions: 30

Compression:

Stored size: 809 Bytes

Contents

require 'mechanize/test_case'

class TestMechanizeFormKeygen < Mechanize::TestCase

  def setup
    super

    keygen = node('keygen',
                  'name' => 'userkey',
                  'challenge' => 'f4832e1d200df3df8c5c859edcabe52f')

    @keygen = Mechanize::Form::Keygen.new keygen
  end

  def test_challenge
    assert_equal "f4832e1d200df3df8c5c859edcabe52f", @keygen.challenge
  end

  def test_key
    assert @keygen.key.kind_of?(OpenSSL::PKey::PKey), "Not an OpenSSL key"
    assert @keygen.key.private?, "Not a private key"
  end

  def test_spki_signature
    spki = OpenSSL::Netscape::SPKI.new @keygen.value
    assert_equal @keygen.challenge, spki.challenge
    assert_equal @keygen.key.public_key.to_pem, spki.public_key.to_pem
    assert spki.verify(@keygen.key.public_key)
  end

end

Version data entries

30 entries across 30 versions & 5 rubygems

Version Path
husc-0.2.1 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_form_keygen.rb
husc-0.2.0 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_form_keygen.rb
husc-0.1.1 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_form_keygen.rb
husc-0.1.0 vendor/bundle/gems/mechanize-2.7.6/test/test_mechanize_form_keygen.rb
mechanize-2.7.6 test/test_mechanize_form_keygen.rb
mechanize-2.7.5 test/test_mechanize_form_keygen.rb
mechanize-2.7.4 test/test_mechanize_form_keygen.rb
mechanize-2.7.3 test/test_mechanize_form_keygen.rb
mechanize-2.7.2 test/test_mechanize_form_keygen.rb
mechanize-2.7.1 test/test_mechanize_form_keygen.rb
mechanize-2.7.0 test/test_mechanize_form_keygen.rb
mechanize-2.6.0 test/test_mechanize_form_keygen.rb
mechanize-2.5.1 test/test_mechanize_form_keygen.rb
mechanize-2.5 test/test_mechanize_form_keygen.rb
mechanize-2.4 test/test_mechanize_form_keygen.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/mechanize-2.3/test/test_mechanize_form_keygen.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/mechanize-2.3/test/test_mechanize_form_keygen.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/mechanize-2.3/test/test_mechanize_form_keygen.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/mechanize-2.3/test/test_mechanize_form_keygen.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/mechanize-2.3/test/test_mechanize_form_keygen.rb