annotate vendor/plugins/open_id_authentication/test/normalize_test.rb @ 915:2a68662d5adf
cannam_integration
*needs further testing* Moved several files' extension to ".erb"; modified two files because they were calling partials/templates with rhtml extensions; renamed email templates sent when a user is added to a publication.
author |
luisf <luis.figueira@eecs.qmul.ac.uk> |
date |
Fri, 02 Mar 2012 12:37:17 +0000 |
parents |
513646585e45 |
children |
|
rev |
line source |
Chris@0
|
1 require File.dirname(__FILE__) + '/test_helper'
|
Chris@0
|
2
|
Chris@0
|
3 class NormalizeTest < Test::Unit::TestCase
|
Chris@0
|
4 include OpenIdAuthentication
|
Chris@0
|
5
|
Chris@0
|
6 NORMALIZATIONS = {
|
Chris@0
|
7 "openid.aol.com/nextangler" => "http://openid.aol.com/nextangler",
|
Chris@0
|
8 "http://openid.aol.com/nextangler" => "http://openid.aol.com/nextangler",
|
Chris@0
|
9 "https://openid.aol.com/nextangler" => "https://openid.aol.com/nextangler",
|
Chris@0
|
10 "HTTP://OPENID.AOL.COM/NEXTANGLER" => "http://openid.aol.com/NEXTANGLER",
|
Chris@0
|
11 "HTTPS://OPENID.AOL.COM/NEXTANGLER" => "https://openid.aol.com/NEXTANGLER",
|
Chris@0
|
12 "loudthinking.com" => "http://loudthinking.com/",
|
Chris@0
|
13 "http://loudthinking.com" => "http://loudthinking.com/",
|
Chris@0
|
14 "http://loudthinking.com:80" => "http://loudthinking.com/",
|
Chris@0
|
15 "https://loudthinking.com:443" => "https://loudthinking.com/",
|
Chris@0
|
16 "http://loudthinking.com:8080" => "http://loudthinking.com:8080/",
|
Chris@0
|
17 "techno-weenie.net" => "http://techno-weenie.net/",
|
Chris@0
|
18 "http://techno-weenie.net" => "http://techno-weenie.net/",
|
Chris@0
|
19 "http://techno-weenie.net " => "http://techno-weenie.net/",
|
Chris@0
|
20 "=name" => "=name"
|
Chris@0
|
21 }
|
Chris@0
|
22
|
Chris@0
|
23 def test_normalizations
|
Chris@0
|
24 NORMALIZATIONS.each do |from, to|
|
Chris@0
|
25 assert_equal to, normalize_identifier(from)
|
Chris@0
|
26 end
|
Chris@0
|
27 end
|
Chris@0
|
28
|
Chris@0
|
29 def test_broken_open_id
|
Chris@0
|
30 assert_raises(InvalidOpenId) { normalize_identifier(nil) }
|
Chris@0
|
31 end
|
Chris@0
|
32 end
|