Sha256: 94479c6749a793e26791acc1af7019165ed7581f3a25503adb4c8ce9d2cb89c0

Contents?: true

Size: 1.11 KB

Versions: 27

Compression:

Stored size: 1.11 KB

Contents

$:.unshift(File.dirname(__FILE__) + "/../lib/")
require File.join(File.dirname(__FILE__), 'test_helper')
require 'test/unit'
require 'active_crypto'
class KeyHolderSubject
  include ActiveCrypto::KeyHolder
end

class KeyHolderTest < Test::Unit::TestCase
  
  attr :key_holder
  
  def setup
    @key_holder=KeyHolderSubject.new
  end
  
  def test_session_key_should_not_be_set_on_new
    assert_nil key_holder.session_key
  end
  
  def test_set_session_key_should_set_session_key
    key=EzCrypto::Key.generate
    key_holder.set_session_key key
    assert_not_nil key_holder.session_key
    assert_equal key.raw,key_holder.session_key.raw
  end
  
  def test_set_encoded_key_should_set_session_key
    key=EzCrypto::Key.generate
    key_holder.set_encoded_key key.encode
    assert_not_nil key_holder.session_key
    assert_equal key.raw,key_holder.session_key.raw
  end
  
  def test_enter_password_should_set_session_key
    key=EzCrypto::Key.with_password "test","onetwothree"
    key_holder.enter_password "test"
    assert_not_nil key_holder.session_key
    assert_equal key.raw,key_holder.session_key.raw
  end
  
    
end

Version data entries

27 entries across 27 versions & 5 rubygems

Version Path
rhodes-3.4.2 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
ezcrypto-0.6 test/key_holder_test.rb
ezcrypto-0.7.2 test/key_holder_test.rb
ezcrypto-0.6.2 test/key_holder_test.rb
ezcrypto-0.5 test/key_holder_test.rb
ezcrypto-0.6.1 test/key_holder_test.rb
ezcrypto-0.7 test/key_holder_test.rb