Skip to content

Commit 14160d2

Browse files
committed
tests: switch to minitest
Drop Ruby 1.9.2 from Travis, since this has issues with the latest verison of Minitest, and Ruby 1.9.2 is not supported upstream any more. Remove admin/runtest.rb, since this is deprecated in favor of simply running "rake" to execute the test suite.
1 parent b9749ca commit 14160d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+280
-345
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: ruby
22
script: rake
33
rvm:
4-
- 1.9.2
54
- 1.9.3
65
- 2.0.0
76
- jruby-19mode

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ source 'https://rubygems.org'
44
gemspec
55

66
gem 'rake'
7-
gem 'test-unit', '>= 2.5.2'

admin/runtests.rb

-45
This file was deleted.

ruby-openid.gemspec

+2
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ Gem::Specification.new do |s|
2323
s.has_rdoc = true
2424
s.extra_rdoc_files = ['README.md', 'INSTALL.md', 'LICENSE', 'UPGRADE.md']
2525
s.rdoc_options << '--main' << 'README.md'
26+
27+
s.add_development_dependency 'minitest', '>= 5'
2628
end

setup.rb

+1-4
Original file line numberDiff line numberDiff line change
@@ -1416,10 +1416,7 @@ def exec_test
14161416
return
14171417
end
14181418
$stderr.puts 'Running tests...' if verbose?
1419-
require 'test/unit'
1420-
runner = Test::Unit::AutoRunner.new(true)
1421-
runner.to_run << TESTDIR
1422-
runner.run
1419+
Dir.glob './test/**/test_*.rb', &method(:require)
14231420
end
14241421

14251422
#

test/test_accept.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
require 'test/unit'
1+
require 'minitest/autorun'
22
require 'testutil'
33
require 'openid/yadis/accept'
44
require 'openid/extras'
55
require 'openid/util'
66

77
module OpenID
88

9-
class AcceptTest < Test::Unit::TestCase
9+
class AcceptTest < Minitest::Test
1010
include TestDataMixin
1111

1212
def getTestData()
@@ -154,7 +154,7 @@ def test_generate_accept_header
154154
].each { |input, expected_header|
155155

156156
if expected_header.nil?
157-
assert_raise(ArgumentError) {
157+
assert_raises(ArgumentError) {
158158
Yadis.generate_accept_header(*input)
159159
}
160160
else

test/test_association.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
require "test/unit"
1+
require "minitest/autorun"
22
require "openid/association"
33

44
module OpenID
5-
class AssociationTestCase < Test::Unit::TestCase
5+
class AssociationTestCase < Minitest::Test
66
def setup
77
# Use this funny way of getting a time so that it does not have
88
# fractional seconds, and so can be serialized exactly using our
@@ -202,7 +202,7 @@ def sign(pairs)
202202
end
203203
end
204204

205-
class AssociationNegotiatorTestCase < Test::Unit::TestCase
205+
class AssociationNegotiatorTestCase < Minitest::Test
206206
def assert_equal_under(item1, item2)
207207
val1 = yield(item1)
208208
val2 = yield(item2)

test/test_associationmanager.rb

+20-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "test/unit"
1+
require "minitest/autorun"
22
require "openid/consumer/associationmanager"
33
require "openid/association"
44
require "openid/dh"
@@ -10,14 +10,12 @@
1010
require "time"
1111

1212
module 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

test/test_ax.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'test/unit'
1+
require 'minitest/autorun'
22
require 'openid/extensions/ax'
33
require 'openid/message'
44
require 'openid/consumer/responses'
@@ -23,7 +23,7 @@ def do_check_mode_new_args
2323
end
2424
end
2525

26-
class AXMessageTest < Test::Unit::TestCase
26+
class AXMessageTest < Minitest::Test
2727
def setup
2828
@bax = BogusAXMessage.new
2929
end
@@ -38,7 +38,7 @@ def test_check_mode_new_args
3838
end
3939
end
4040

41-
class AttrInfoTest < Test::Unit::TestCase
41+
class AttrInfoTest < Minitest::Test
4242
def test_construct
4343
assert_raises(ArgumentError) { AttrInfo.new }
4444
type_uri = 'uri geller'
@@ -51,7 +51,7 @@ def test_construct
5151
end
5252
end
5353

54-
class ToTypeURIsTest < Test::Unit::TestCase
54+
class ToTypeURIsTest < Minitest::Test
5555
def setup
5656
@aliases = NamespaceMap.new
5757
end
@@ -91,7 +91,7 @@ def test_two
9191
end
9292
end
9393

94-
class ParseAXValuesTest < Test::Unit::TestCase
94+
class ParseAXValuesTest < Minitest::Test
9595
def ax_values(ax_args, expected_args)
9696
msg = KeyValueMessage.new
9797
msg.parse_extension_args(ax_args)
@@ -221,7 +221,7 @@ def singleton_value
221221
end
222222
end
223223

224-
class FetchRequestTest < Test::Unit::TestCase
224+
class FetchRequestTest < Minitest::Test
225225
def setup
226226
@msg = FetchRequest.new
227227
@type_a = 'http://janrain.example.com/a'
@@ -483,7 +483,7 @@ def test_add_extension
483483
end
484484
end
485485

486-
class FetchResponseTest < Test::Unit::TestCase
486+
class FetchResponseTest < Minitest::Test
487487
def setup
488488
@msg = FetchResponse.new
489489
@value_a = 'commodity'
@@ -675,7 +675,7 @@ def test_from_empty_success_response
675675
end
676676
end
677677

678-
class StoreRequestTest < Test::Unit::TestCase
678+
class StoreRequestTest < Minitest::Test
679679
def setup
680680
@msg = StoreRequest.new
681681
@type_a = 'http://oranges.are.for/'
@@ -729,7 +729,7 @@ def test_get_extension_args_nonempty
729729
end
730730
end
731731

732-
class StoreResponseTest < Test::Unit::TestCase
732+
class StoreResponseTest < Minitest::Test
733733
def test_success
734734
msg = StoreResponse.new
735735
assert(msg.succeeded?)

0 commit comments

Comments
 (0)