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-7.6.0 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-7.5.1 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-7.4.1 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-7.1.17 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-6.2.0 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
ezcrypto2-0.0.2 test/key_holder_test.rb
rhodes-6.0.11 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.18 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.17 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.15 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.0.22 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.2 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.0.7 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.0.3 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
rhodes-5.5.0 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
tauplatform-1.0.3 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
tauplatform-1.0.2 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
tauplatform-1.0.1 lib/extensions/ezcrypto/ext/test/key_holder_test.rb
jamescook-ezcrypto-0.7.4 test/key_holder_test.rb
rhodes-3.5.1.12 lib/extensions/ezcrypto/ext/test/key_holder_test.rb