1- require "test/unit "
1+ require "minitest/autorun "
22require "openid/consumer/associationmanager"
33require "openid/association"
44require "openid/dh"
1010require "time"
1111
1212module OpenID
13- class DHAssocSessionTest < Test :: Unit :: TestCase
13+ class DHAssocSessionTest < Minitest :: Test
1414 def test_sha1_get_request
1515 # Initialized without an explicit DH gets defaults
1616 sess = Consumer ::DiffieHellmanSHA1Session . new
1717 assert_equal ( [ 'dh_consumer_public' ] , sess . get_request . keys )
18- assert_nothing_raised do
19- Util ::from_base64 ( sess . get_request [ 'dh_consumer_public' ] )
20- end
18+ Util ::from_base64 ( sess . get_request [ 'dh_consumer_public' ] )
2119 end
2220
2321 def test_sha1_get_request_custom_dh
@@ -28,9 +26,7 @@ def test_sha1_get_request_custom_dh
2826 req . keys . sort )
2927 assert_equal ( dh . modulus , CryptUtil . base64_to_num ( req [ 'dh_modulus' ] ) )
3028 assert_equal ( dh . generator , CryptUtil . base64_to_num ( req [ 'dh_gen' ] ) )
31- assert_nothing_raised do
32- Util ::from_base64 ( req [ 'dh_consumer_public' ] )
33- end
29+ Util ::from_base64 ( req [ 'dh_consumer_public' ] )
3430 end
3531 end
3632
@@ -102,7 +98,7 @@ def test_invalid_base64_mac_key
10298 end
10399 end
104100
105- class TestConsumerOpenID1DHSHA1 < Test :: Unit :: TestCase
101+ class TestConsumerOpenID1DHSHA1 < Minitest :: Test
106102 include TestDiffieHellmanResponseParametersMixin
107103 class << self
108104 attr_reader :session_cls , :message_namespace
@@ -112,7 +108,7 @@ class << self
112108 @message_namespace = OPENID1_NS
113109 end
114110
115- class TestConsumerOpenID2DHSHA1 < Test :: Unit :: TestCase
111+ class TestConsumerOpenID2DHSHA1 < Minitest :: Test
116112 include TestDiffieHellmanResponseParametersMixin
117113 class << self
118114 attr_reader :session_cls , :message_namespace
@@ -122,7 +118,7 @@ class << self
122118 @message_namespace = OPENID2_NS
123119 end
124120
125- class TestConsumerOpenID2DHSHA256 < Test :: Unit :: TestCase
121+ class TestConsumerOpenID2DHSHA256 < Minitest :: Test
126122 include TestDiffieHellmanResponseParametersMixin
127123 class << self
128124 attr_reader :session_cls , :message_namespace
@@ -132,7 +128,7 @@ class << self
132128 @message_namespace = OPENID2_NS
133129 end
134130
135- class TestConsumerNoEncryptionSession < Test :: Unit :: TestCase
131+ class TestConsumerNoEncryptionSession < Minitest :: Test
136132 def setup
137133 @sess = Consumer ::NoEncryptionSession . new
138134 end
@@ -149,7 +145,7 @@ def test_get_secret
149145 end
150146 end
151147
152- class TestCreateAssociationRequest < Test :: Unit :: TestCase
148+ class TestCreateAssociationRequest < Minitest :: Test
153149 def setup
154150 @server_url = 'http://invalid/'
155151 @assoc_manager = Consumer ::AssociationManager . new ( nil , @server_url )
@@ -203,7 +199,7 @@ def test_dh_sha1_compatibility
203199
204200 # This is a random base-64 value, so just check that it's
205201 # present.
206- assert_not_nil ( args . get_arg ( OPENID1_NS , 'dh_consumer_public' ) )
202+ refute_nil ( args . get_arg ( OPENID1_NS , 'dh_consumer_public' ) )
207203 args . del_arg ( OPENID1_NS , 'dh_consumer_public' )
208204
209205 # OK, session_type is set here and not for no-encryption
@@ -216,7 +212,7 @@ def test_dh_sha1_compatibility
216212 end
217213 end
218214
219- class TestAssociationManagerExpiresIn < Test :: Unit :: TestCase
215+ class TestAssociationManagerExpiresIn < Minitest :: Test
220216 def expires_in_msg ( val )
221217 msg = Message . from_openid_args ( { 'expires_in' => val } )
222218 Consumer ::AssociationManager . extract_expires_in ( msg )
@@ -248,7 +244,7 @@ def test_parse
248244 end
249245 end
250246
251- class TestAssociationManagerCreateSession < Test :: Unit :: TestCase
247+ class TestAssociationManagerCreateSession < Minitest :: Test
252248 def test_invalid
253249 assert_raises ( ArgumentError ) {
254250 Consumer ::AssociationManager . create_session ( 'monkeys' )
@@ -292,7 +288,7 @@ def request_association(assoc_type, session_type)
292288
293289 # Test the session type negotiation behavior of an OpenID 2
294290 # consumer.
295- class TestOpenID2SessionNegotiation < Test :: Unit :: TestCase
291+ class TestOpenID2SessionNegotiation < Minitest :: Test
296292 include NegotiationTestMixin
297293
298294 Compat = false
@@ -413,7 +409,7 @@ def test_valid
413409 # oidutil.log. See the calls to self.failUnlessLogMatches. Some of
414410 # these tests pass openid2-style messages to the openid 1
415411 # association processing logic to be sure it ignores the extra data.
416- class TestOpenID1SessionNegotiation < Test :: Unit :: TestCase
412+ class TestOpenID1SessionNegotiation < Minitest :: Test
417413 include NegotiationTestMixin
418414
419415 Compat = true
@@ -498,7 +494,7 @@ def test_valid
498494 end
499495
500496
501- class TestExtractAssociation < Test :: Unit :: TestCase
497+ class TestExtractAssociation < Minitest :: Test
502498 include ProtocolErrorMixin
503499
504500 # An OpenID associate response (without the namespace)
@@ -619,7 +615,7 @@ def test_openid1_no_encryption_fallback
619615 end
620616 end
621617
622- class GetOpenIDSessionTypeTest < Test :: Unit :: TestCase
618+ class GetOpenIDSessionTypeTest < Minitest :: Test
623619 include TestUtil
624620
625621 SERVER_URL = 'http://invalid/'
@@ -666,7 +662,7 @@ def test_explicit_no_encryption
666662 end
667663 end
668664
669- class ExtractAssociationTest < Test :: Unit :: TestCase
665+ class ExtractAssociationTest < Minitest :: Test
670666 include ProtocolErrorMixin
671667
672668 SERVER_URL = 'http://invalid/'
@@ -740,7 +736,7 @@ def test_bad_expires_in
740736 end
741737 end
742738
743- class TestExtractAssociationDiffieHellman < Test :: Unit :: TestCase
739+ class TestExtractAssociationDiffieHellman < Minitest :: Test
744740 include ProtocolErrorMixin
745741
746742 SECRET = 'x' * 20
@@ -799,7 +795,7 @@ def test_bad_dh_values
799795 end
800796 end
801797
802- class TestAssocManagerGetAssociation < Test :: Unit :: TestCase
798+ class TestAssocManagerGetAssociation < Minitest :: Test
803799 include FetcherMixin
804800 include TestUtil
805801
@@ -859,7 +855,7 @@ def test_request_assoc_with_status_error
859855 end
860856 end
861857
862- class TestAssocManagerRequestAssociation < Test :: Unit :: TestCase
858+ class TestAssocManagerRequestAssociation < Minitest :: Test
863859 include FetcherMixin
864860 include TestUtil
865861
0 commit comments