Chris@0: require File.dirname(__FILE__) + '/test_helper' Chris@0: Chris@0: class NormalizeTest < Test::Unit::TestCase Chris@0: include OpenIdAuthentication Chris@0: Chris@0: NORMALIZATIONS = { Chris@0: "openid.aol.com/nextangler" => "http://openid.aol.com/nextangler", Chris@0: "http://openid.aol.com/nextangler" => "http://openid.aol.com/nextangler", Chris@0: "https://openid.aol.com/nextangler" => "https://openid.aol.com/nextangler", Chris@0: "HTTP://OPENID.AOL.COM/NEXTANGLER" => "http://openid.aol.com/NEXTANGLER", Chris@0: "HTTPS://OPENID.AOL.COM/NEXTANGLER" => "https://openid.aol.com/NEXTANGLER", Chris@0: "loudthinking.com" => "http://loudthinking.com/", Chris@0: "http://loudthinking.com" => "http://loudthinking.com/", Chris@0: "http://loudthinking.com:80" => "http://loudthinking.com/", Chris@0: "https://loudthinking.com:443" => "https://loudthinking.com/", Chris@0: "http://loudthinking.com:8080" => "http://loudthinking.com:8080/", Chris@0: "techno-weenie.net" => "http://techno-weenie.net/", Chris@0: "http://techno-weenie.net" => "http://techno-weenie.net/", Chris@0: "http://techno-weenie.net " => "http://techno-weenie.net/", Chris@0: "=name" => "=name" Chris@0: } Chris@0: Chris@0: def test_normalizations Chris@0: NORMALIZATIONS.each do |from, to| Chris@0: assert_equal to, normalize_identifier(from) Chris@0: end Chris@0: end Chris@0: Chris@0: def test_broken_open_id Chris@0: assert_raises(InvalidOpenId) { normalize_identifier(nil) } Chris@0: end Chris@0: end