You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

normalize_test.rb 1.4KB

1234567891011121314151617181920212223242526272829303132
  1. require File.dirname(__FILE__) + '/test_helper'
  2. class NormalizeTest < Test::Unit::TestCase
  3. include OpenIdAuthentication
  4. NORMALIZATIONS = {
  5. "openid.aol.com/nextangler" => "http://openid.aol.com/nextangler",
  6. "http://openid.aol.com/nextangler" => "http://openid.aol.com/nextangler",
  7. "https://openid.aol.com/nextangler" => "https://openid.aol.com/nextangler",
  8. "HTTP://OPENID.AOL.COM/NEXTANGLER" => "http://openid.aol.com/NEXTANGLER",
  9. "HTTPS://OPENID.AOL.COM/NEXTANGLER" => "https://openid.aol.com/NEXTANGLER",
  10. "loudthinking.com" => "http://loudthinking.com/",
  11. "http://loudthinking.com" => "http://loudthinking.com/",
  12. "http://loudthinking.com:80" => "http://loudthinking.com/",
  13. "https://loudthinking.com:443" => "https://loudthinking.com/",
  14. "http://loudthinking.com:8080" => "http://loudthinking.com:8080/",
  15. "techno-weenie.net" => "http://techno-weenie.net/",
  16. "http://techno-weenie.net" => "http://techno-weenie.net/",
  17. "http://techno-weenie.net " => "http://techno-weenie.net/",
  18. "=name" => "=name"
  19. }
  20. def test_normalizations
  21. NORMALIZATIONS.each do |from, to|
  22. assert_equal to, normalize_identifier(from)
  23. end
  24. end
  25. def test_broken_open_id
  26. assert_raises(InvalidOpenId) { normalize_identifier(nil) }
  27. end
  28. end