1
- require "test/unit "
1
+ require "minitest/autorun "
2
2
require "openid/consumer/associationmanager"
3
3
require "openid/association"
4
4
require "openid/dh"
10
10
require "time"
11
11
12
12
module OpenID
13
- class DHAssocSessionTest < Test :: Unit :: TestCase
13
+ class DHAssocSessionTest < Minitest :: Test
14
14
def test_sha1_get_request
15
15
# Initialized without an explicit DH gets defaults
16
16
sess = Consumer ::DiffieHellmanSHA1Session . new
17
17
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' ] )
21
19
end
22
20
23
21
def test_sha1_get_request_custom_dh
@@ -28,9 +26,7 @@ def test_sha1_get_request_custom_dh
28
26
req . keys . sort )
29
27
assert_equal ( dh . modulus , CryptUtil . base64_to_num ( req [ 'dh_modulus' ] ) )
30
28
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' ] )
34
30
end
35
31
end
36
32
@@ -102,7 +98,7 @@ def test_invalid_base64_mac_key
102
98
end
103
99
end
104
100
105
- class TestConsumerOpenID1DHSHA1 < Test :: Unit :: TestCase
101
+ class TestConsumerOpenID1DHSHA1 < Minitest :: Test
106
102
include TestDiffieHellmanResponseParametersMixin
107
103
class << self
108
104
attr_reader :session_cls , :message_namespace
@@ -112,7 +108,7 @@ class << self
112
108
@message_namespace = OPENID1_NS
113
109
end
114
110
115
- class TestConsumerOpenID2DHSHA1 < Test :: Unit :: TestCase
111
+ class TestConsumerOpenID2DHSHA1 < Minitest :: Test
116
112
include TestDiffieHellmanResponseParametersMixin
117
113
class << self
118
114
attr_reader :session_cls , :message_namespace
@@ -122,7 +118,7 @@ class << self
122
118
@message_namespace = OPENID2_NS
123
119
end
124
120
125
- class TestConsumerOpenID2DHSHA256 < Test :: Unit :: TestCase
121
+ class TestConsumerOpenID2DHSHA256 < Minitest :: Test
126
122
include TestDiffieHellmanResponseParametersMixin
127
123
class << self
128
124
attr_reader :session_cls , :message_namespace
@@ -132,7 +128,7 @@ class << self
132
128
@message_namespace = OPENID2_NS
133
129
end
134
130
135
- class TestConsumerNoEncryptionSession < Test :: Unit :: TestCase
131
+ class TestConsumerNoEncryptionSession < Minitest :: Test
136
132
def setup
137
133
@sess = Consumer ::NoEncryptionSession . new
138
134
end
@@ -149,7 +145,7 @@ def test_get_secret
149
145
end
150
146
end
151
147
152
- class TestCreateAssociationRequest < Test :: Unit :: TestCase
148
+ class TestCreateAssociationRequest < Minitest :: Test
153
149
def setup
154
150
@server_url = 'http://invalid/'
155
151
@assoc_manager = Consumer ::AssociationManager . new ( nil , @server_url )
@@ -203,7 +199,7 @@ def test_dh_sha1_compatibility
203
199
204
200
# This is a random base-64 value, so just check that it's
205
201
# present.
206
- assert_not_nil ( args . get_arg ( OPENID1_NS , 'dh_consumer_public' ) )
202
+ refute_nil ( args . get_arg ( OPENID1_NS , 'dh_consumer_public' ) )
207
203
args . del_arg ( OPENID1_NS , 'dh_consumer_public' )
208
204
209
205
# OK, session_type is set here and not for no-encryption
@@ -216,7 +212,7 @@ def test_dh_sha1_compatibility
216
212
end
217
213
end
218
214
219
- class TestAssociationManagerExpiresIn < Test :: Unit :: TestCase
215
+ class TestAssociationManagerExpiresIn < Minitest :: Test
220
216
def expires_in_msg ( val )
221
217
msg = Message . from_openid_args ( { 'expires_in' => val } )
222
218
Consumer ::AssociationManager . extract_expires_in ( msg )
@@ -248,7 +244,7 @@ def test_parse
248
244
end
249
245
end
250
246
251
- class TestAssociationManagerCreateSession < Test :: Unit :: TestCase
247
+ class TestAssociationManagerCreateSession < Minitest :: Test
252
248
def test_invalid
253
249
assert_raises ( ArgumentError ) {
254
250
Consumer ::AssociationManager . create_session ( 'monkeys' )
@@ -292,7 +288,7 @@ def request_association(assoc_type, session_type)
292
288
293
289
# Test the session type negotiation behavior of an OpenID 2
294
290
# consumer.
295
- class TestOpenID2SessionNegotiation < Test :: Unit :: TestCase
291
+ class TestOpenID2SessionNegotiation < Minitest :: Test
296
292
include NegotiationTestMixin
297
293
298
294
Compat = false
@@ -413,7 +409,7 @@ def test_valid
413
409
# oidutil.log. See the calls to self.failUnlessLogMatches. Some of
414
410
# these tests pass openid2-style messages to the openid 1
415
411
# association processing logic to be sure it ignores the extra data.
416
- class TestOpenID1SessionNegotiation < Test :: Unit :: TestCase
412
+ class TestOpenID1SessionNegotiation < Minitest :: Test
417
413
include NegotiationTestMixin
418
414
419
415
Compat = true
@@ -498,7 +494,7 @@ def test_valid
498
494
end
499
495
500
496
501
- class TestExtractAssociation < Test :: Unit :: TestCase
497
+ class TestExtractAssociation < Minitest :: Test
502
498
include ProtocolErrorMixin
503
499
504
500
# An OpenID associate response (without the namespace)
@@ -619,7 +615,7 @@ def test_openid1_no_encryption_fallback
619
615
end
620
616
end
621
617
622
- class GetOpenIDSessionTypeTest < Test :: Unit :: TestCase
618
+ class GetOpenIDSessionTypeTest < Minitest :: Test
623
619
include TestUtil
624
620
625
621
SERVER_URL = 'http://invalid/'
@@ -666,7 +662,7 @@ def test_explicit_no_encryption
666
662
end
667
663
end
668
664
669
- class ExtractAssociationTest < Test :: Unit :: TestCase
665
+ class ExtractAssociationTest < Minitest :: Test
670
666
include ProtocolErrorMixin
671
667
672
668
SERVER_URL = 'http://invalid/'
@@ -740,7 +736,7 @@ def test_bad_expires_in
740
736
end
741
737
end
742
738
743
- class TestExtractAssociationDiffieHellman < Test :: Unit :: TestCase
739
+ class TestExtractAssociationDiffieHellman < Minitest :: Test
744
740
include ProtocolErrorMixin
745
741
746
742
SECRET = 'x' * 20
@@ -799,7 +795,7 @@ def test_bad_dh_values
799
795
end
800
796
end
801
797
802
- class TestAssocManagerGetAssociation < Test :: Unit :: TestCase
798
+ class TestAssocManagerGetAssociation < Minitest :: Test
803
799
include FetcherMixin
804
800
include TestUtil
805
801
@@ -859,7 +855,7 @@ def test_request_assoc_with_status_error
859
855
end
860
856
end
861
857
862
- class TestAssocManagerRequestAssociation < Test :: Unit :: TestCase
858
+ class TestAssocManagerRequestAssociation < Minitest :: Test
863
859
include FetcherMixin
864
860
include TestUtil
865
861
0 commit comments