Make rssUrl and atomUrl variables respond to exportMode.

This commit is contained in:
Colin Kuskie 2009-04-16 21:19:17 +00:00
parent 1ddf1b50a4
commit c439453784
4 changed files with 57 additions and 20 deletions

View file

@ -58,7 +58,7 @@ $canPostMaker->prepare({
fail => [1, $reader ],
});
my $tests = 33
my $tests = 35
+ $canPostMaker->plan
;
plan tests => 1
@ -195,6 +195,15 @@ cmp_deeply(
'viewTemplateVars: search variables present'
);
cmp_deeply(
$templateVars,
superhashof({
rssUrl => $archive->getRssFeedUrl,
atomUrl => $archive->getAtomFeedUrl,
}),
'viewTemplateVars: RSS and Atom feed template variables'
);
KEY: foreach my $key (keys %{ $templateVars }) {
next KEY if isIn($key, qw/canPostStories addStoryUrl date_loop mode/);
delete $templateVars->{$key};
@ -380,6 +389,25 @@ cmp_bag(
'viewTemplateVariables: search mode returns the correct assets in the same form as view mode'
);
$archive->{_exportMode} = 1;
$templateVars = $archive->viewTemplateVariables();
ok( ( !exists $templateVars->{searchHeader}
&& !exists $templateVars->{searchForm}
&& !exists $templateVars->{searchButton}
&& !exists $templateVars->{searchForm}
),
'... export mode, no search variables present'
);
cmp_deeply(
$templateVars,
superhashof({
rssUrl => $archive->getStaticRssFeedUrl,
atomUrl => $archive->getStaticAtomFeedUrl,
}),
'... export mode, RSS and Atom feed template variables show the static url'
);
$archive->{_exportMode} = 0;
################################################################
#
@ -399,17 +427,6 @@ cmp_bag(
'keywordCloud template variable has keywords and correct links',
);
$archive->{_exportMode} = 1;
$templateVars = $archive->viewTemplateVariables();
ok( ( !exists $templateVars->{searchHeader}
&& !exists $templateVars->{searchForm}
&& !exists $templateVars->{searchButton}
&& !exists $templateVars->{searchForm}
),
'... export mode, no search variables present'
);
$archive->{_exportMode} = 0;
################################################################
#
# RSS and Atom checks

View file

@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 15;
my $tests = 17;
plan tests => 1 + $tests;
#----------------------------------------------------------------------------
@ -94,6 +94,15 @@ $versionTag->commit;
my $templateVars;
$templateVars = $topic->viewTemplateVariables();
cmp_deeply(
$templateVars,
superhashof({
rssUrl => $topic->getRssFeedUrl,
atomUrl => $topic->getAtomFeedUrl,
}),
'viewTemplateVars: RSS and Atom feed template variables'
);
cmp_deeply(
$templateVars->{story_loop},
[
@ -254,6 +263,15 @@ cmp_deeply(
],
'... export mode, URLs are the regular story URLs'
);
cmp_deeply(
$templateVars,
superhashof({
rssUrl => $topic->getStaticRssFeedUrl,
atomUrl => $topic->getStaticAtomFeedUrl,
}),
'... export mode, RSS and Atom feed template variables show the static url'
);
$topic->{_exportMode} = 0;
}