Skip to content

Commit

Permalink
Item9015: Add unit test to confirm attachments missing from metadata …
Browse files Browse the repository at this point in the history
…are found.

git-svn-id: http://svn.foswiki.org/trunk/AttachmentListPlugin@7397 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed May 14, 2010
1 parent 738b6fb commit 8ffb9ac
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/unit/AttachmentListPlugin/AttachmentListPluginTests.pm
Expand Up @@ -13,6 +13,7 @@ use Foswiki::OopsException;
use Foswiki::Plugins::AttachmentListPlugin;
use Devel::Symdump;
use Data::Dumper;
use File::Path qw(mkpath);

my %testAttachments = (
topic1 => {
Expand Down Expand Up @@ -192,6 +193,39 @@ sub test_param_topic {

=pod
Test retrieval of attachments autoattached, and not in metadata.
=cut

sub test_Item9015 {
my $this = shift;

my $testTopic1 = $testAttachments{topic1}{name};
my $testTopic2 = $testAttachments{topic2}{name};

my $source =
"%ATTACHMENTLIST{topic=\"$testTopic1,$testTopic2\" format=\"\$fileName\" separator=\",\" sort=\"\$fileName\"}%";

my $expected =
'A_important_salary_raise.txt,AutoAttachedFile.blah,B_contract_negotiations.txt,C_image.jpg,D_photo.PNG';


my $content = "datadata\n";
my $path = $Foswiki::cfg{PubDir} . '/' . $this->{test_web} . '/' . $testTopic1;
my $file = 'AutoAttachedFile.blah';

mkpath($path);
open( my $fh, '>', "$path/$file" )
or die "Unable to open $path/$file for writing: $!\n";
print $fh "$content \n";
close($fh);

$this->_do_test( $testTopic1, $expected, $source );

unlink "$path/$file";
}
=pod
TODO:
Test retrieval of attachments of specified topic 1, passed 2 times.
Expand Down

0 comments on commit 8ffb9ac

Please sign in to comment.