Skip to content

Commit

Permalink
Fix error in stock bookcover template and tests
Browse files Browse the repository at this point in the history
Lately we don't allow root peaking in other sites.
  • Loading branch information
melmothx committed Aug 25, 2024
1 parent ab2ecba commit 9d7ee75
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/AmuseWikiFarm/Schema/Result/Bookcover.pm
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ sub create_working_dir {
\begin{flushright}
\includegraphics[height=3cm]{[% isbn_isbn %]}
\end{flushright}
}
[% END %]
}
\end{bookcover}
\end{document}
LATEX
Expand Down
19 changes: 13 additions & 6 deletions t/bookcover.t
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,26 @@ ok $anon_bc;
is_deeply $tokens, [
{ name => 'author', type => 'muse_str', full_name => 'author_muse_str' },
{ name => 'title', type => 'muse_str', full_name => 'title_muse_str' },
{ name => 'subtitle', type => 'muse_str', full_name => 'subtitle_muse_str' },
{ name => 'image', type => 'file', full_name => 'image_file' },
{ name => 'image_width_in_mm', type => 'int', full_name => 'image_width_in_mm_int' },
{ name => "front_footer", type => "muse_str", full_name => "front_footer_muse_str" },
{ name => 'back_text', type => 'muse_body', full_name => 'back_text_muse_body' },
{ name => 'isbn', type => 'isbn', full_name => 'isbn_isbn' }
];
] or die Dumper($tokens);
path("t/files/shot.png")->copy($anon_bc->working_dir->child("f1.png"));
$anon_bc->populate_tokens;
$anon_bc->populate_tokens;
is $anon_bc->bookcover_tokens->count, 5;
is $anon_bc->bookcover_tokens->count, 8;
$anon_bc->update_from_params({
title_muse_str => "Title *title*",
author_muse_str => "Author *author*",
spinewidth => 'asdf',
back_text_muse_body => "This\n\nIs\n\nThe *back*",
image_file => "f1.png",
image_width_in_mm_int => 10,
front_footer_muse_str => "Test",
subtitle_muse_str => "test",
});
ok $anon_bc->font_name, "Font name set";
diag $anon_bc->font_name;
Expand Down Expand Up @@ -110,7 +116,7 @@ ok $anon_bc;
like $tex_body, qr(\\usepackage.*italian.*\{babel\});
like $tex_body, qr{texgyrepagella};
like $tex_body, qr{includegraphics};
diag $tex_body;
diag "$outfile";
my $res = $anon_bc->produce_pdf(sub { diag @_ });
ok $res->{success} or die $res->{stdout};
# diag Dumper($res);
Expand Down Expand Up @@ -251,9 +257,10 @@ my $tuser = $site->update_or_create_user({
diag $1;
push @found, $2;
}
is scalar(@found), $schema->resultset('Bookcover')->count, "Found all covers: " . join(' ', @found);
ok scalar(grep { $_ == $otherbc->bookcover_id } @found), "Found the bc from other site";
$mech->get_ok('/bookcovers/bc/' . $otherbc->bookcover_id . '/edit');
is scalar(@found), $site->bookcovers->count, "Found only sites: " . join(' ', @found);
ok !scalar(grep { $_ == $otherbc->bookcover_id } @found), "bc from other site not found";
$mech->get('/bookcovers/bc/' . $otherbc->bookcover_id . '/edit');
is $mech->status, 404;
$mech->get_ok('/logout');

$mech->get('/bookcovers/bc/' . $otherbc->bookcover_id . '/edit');
Expand Down

0 comments on commit 9d7ee75

Please sign in to comment.