X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Farticles%2Furi-articles.t;h=9ad4b07248bd9334850b588e94d6a21f30cfd82c;hb=ae14e320388fa5e7f400bff1c251ef885b7952e6;hp=4124b194250f39a2dbabc68d9a8de9760bc21329;hpb=a6fe07e49e3fc12169e801b1ed6874c3a5bd8500;p=freeside.git diff --git a/rt/t/articles/uri-articles.t b/rt/t/articles/uri-articles.t index 4124b1942..9ad4b0724 100644 --- a/rt/t/articles/uri-articles.t +++ b/rt/t/articles/uri-articles.t @@ -1,9 +1,9 @@ -#!/usr/bin/perl use strict; use warnings; -use RT::Test tests => 9; +use RT::Test tests => undef; +use Test::Warn; use_ok "RT::URI::fsck_com_article"; my $uri = RT::URI::fsck_com_article->new( $RT::SystemUser ); @@ -13,7 +13,7 @@ isa_ok $uri, 'RT::URI::fsck_com_article'; isa_ok $uri, 'RT::URI::base'; isa_ok $uri, 'RT::Base'; -is $uri->LocalURIPrefix, 'fsck.com-article://example.com/article/'; +is $uri->LocalURIPrefix, 'fsck.com-article://example.com'; my $class = RT::Class->new( $RT::SystemUser ); $class->Create( Name => 'URItest - '. $$ ); @@ -27,5 +27,24 @@ my ($id, $msg) = $article->Create( ok($id,$msg); $uri = RT::URI::fsck_com_article->new( $article->CurrentUser ); -is $uri->LocalURIPrefix . $article->id, $uri->URIForObject( $article ); +is $uri->URIForObject( $article ), + 'fsck.com-article://example.com/article/' . $article->id, + 'Got correct URIForObject'; +my $article_id = $article->Id; +ok ($uri->ParseURI("fsck.com-article://example.com/article/$article_id"), + 'Parsed URI'); +ok ($article->Delete(), 'Deleted article'); + +my $ret; +warning_like { + $ret = $uri->ParseURI("fsck.com-article://example.com/article/$article_id"); +} qr/Unable to load article for id $article_id. It may have been deleted/, + "Warned about missing article"; + +ok (!$ret, 'Returned false on missing article'); + +ok (!$uri->ParseURI("fsck.com-article://foo.com/article/$article_id"), + 'ParseURI returned false with incorrect Organization'); + +done_testing();