Class: KeyHolderTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/extensions/ezcrypto/ext/test/key_holder_test.rb

Direct Known Subclasses

AssociationKeyHolderTest

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#key_holderObject (readonly)

Returns the value of attribute key_holder.



11
12
13
# File 'lib/extensions/ezcrypto/ext/test/key_holder_test.rb', line 11

def key_holder
  @key_holder
end

Instance Method Details

#setupObject



13
14
15
# File 'lib/extensions/ezcrypto/ext/test/key_holder_test.rb', line 13

def setup
  @key_holder=KeyHolderSubject.new
end

#test_enter_password_should_set_session_keyObject



35
36
37
38
39
40
# File 'lib/extensions/ezcrypto/ext/test/key_holder_test.rb', line 35

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

#test_session_key_should_not_be_set_on_newObject



17
18
19
# File 'lib/extensions/ezcrypto/ext/test/key_holder_test.rb', line 17

def test_session_key_should_not_be_set_on_new
  assert_nil key_holder.session_key
end

#test_set_encoded_key_should_set_session_keyObject



28
29
30
31
32
33
# File 'lib/extensions/ezcrypto/ext/test/key_holder_test.rb', line 28

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

#test_set_session_key_should_set_session_keyObject



21
22
23
24
25
26
# File 'lib/extensions/ezcrypto/ext/test/key_holder_test.rb', line 21

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