To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / .svn / pristine / 01 / 0171e251406a6b1885f3fa9813dc6f97a4ee7ea8.svn-base @ 912:5e80956cc792

History | View | Annotate | Download (1.42 KB)

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