response
[ikiwiki.git] / t / openiduser.t
blob74609010311bab89aec092215aa5a8e21663d298
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
5 BEGIN {
6 eval q{
7 use Net::OpenID::VerifiedIdentity;
8 };
9 if ($@) {
10 eval q{use Test::More skip_all => "Net::OpenID::VerifiedIdentity not available"};
12 else {
13 eval q{use Test::More tests => 11};
15 use_ok("IkiWiki");
18 # Some typical examples:
20 # This test, when run by Test::Harness using perl -w, exposes a warning in
21 # Net::OpenID::VerifiedIdentity. Normally that warning is not displayed, as
22 # that module does not use warnings. To avoid cluttering the test output,
23 # disable the -w switch temporarily.
24 $^W=0;
25 is(IkiWiki::openiduser('http://josephturian.blogspot.com'), 'josephturian [blogspot.com]');
26 $^W=1;
28 is(IkiWiki::openiduser('http://yam655.livejournal.com/'), 'yam655 [livejournal.com]');
29 is(IkiWiki::openiduser('http://id.mayfirst.org/jamie/'), 'jamie [id.mayfirst.org]');
31 # yahoo has an anchor in the url
32 is(IkiWiki::openiduser('https://me.yahoo.com/joeyhess#35f22'), 'joeyhess [me.yahoo.com]');
33 # google urls are horrendous, but the worst bit is after a ?, so can be dropped
34 is(IkiWiki::openiduser('https://www.google.com/accounts/o8/id?id=AItOawm-ebiIfxbKD3KNa-Cu9LvvD9edMLW7BAo'), 'id [www.google.com/accounts/o8]');
36 # and some less typical ones taken from the ikiwiki commit history
38 is(IkiWiki::openiduser('http://thm.id.fedoraproject.org/'), 'thm [id.fedoraproject.org]');
39 is(IkiWiki::openiduser('http://dtrt.org/'), 'dtrt.org');
40 is(IkiWiki::openiduser('http://alcopop.org/me/openid/'), 'openid [alcopop.org/me]');
41 is(IkiWiki::openiduser('http://id.launchpad.net/882/bielawski1'), 'bielawski1 [id.launchpad.net/882]');
42 is(IkiWiki::openiduser('http://technorati.com/people/technorati/drajt'), 'drajt [technorati.com/people/technorati]');