Ignore:
Timestamp:
11/19/08 19:11:33 (4 years ago)
Author:
CrawfordCurrie
Message:

Item175: ported unit tests to new namespace. They all pass.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/test/unit/AutoAttachTests.pm

    r492 r816  
    33# Test cases: 
    44# 1) Autoattach = off. Save a topic referring to an attachmentMissing that does not exist. 
    5 # 2) Add attachmentAdded into the attachment area for that topic, circumventing TWiki 
     5# 2) Add attachmentAdded into the attachment area for that topic, circumventing Foswiki 
    66# 3) Turn autoattach = on. Ask for the list of attachments. attachmentAdded should appear. attachmentMissing should not. 
    77 
    88package AutoAttachTests; 
    9 use base qw(TWikiFnTestCase); 
     9use base qw(FoswikiFnTestCase); 
    1010 
    1111use strict; 
    12 use TWiki; 
    13 use TWiki::Meta; 
     12use Foswiki; 
     13use Foswiki::Meta; 
    1414use Error qw( :try ); 
    15 use TWiki::UI::Save; 
    16 use TWiki::OopsException; 
     15use Foswiki::UI::Save; 
     16use Foswiki::OopsException; 
    1717use Devel::Symdump; 
    1818 
     
    7272    my $this = shift; 
    7373    my ($topic, @filenames) = @_; 
    74     my $dir = $TWiki::cfg{PubDir}; 
     74    my $dir = $Foswiki::cfg{PubDir}; 
    7575    $dir = "$dir/$this->{test_web}/$topic"; 
    7676    #print STDERR "DEBUG: dir=$dir\n"; 
     
    9494 
    9595sub test_autoattach { 
    96 #   print "Default AutoAttachPubFiles = $TWiki::cfg{AutoAttachPubFiles}\n"; 
    97     $TWiki::cfg{AutoAttachPubFiles} = 1; 
    98 #   print "AutoAttachPubFiles now = $TWiki::cfg{AutoAttachPubFiles}\n"; 
     96#   print "Default AutoAttachPubFiles = $Foswiki::cfg{AutoAttachPubFiles}\n"; 
     97    $Foswiki::cfg{AutoAttachPubFiles} = 1; 
     98#   print "AutoAttachPubFiles now = $Foswiki::cfg{AutoAttachPubFiles}\n"; 
    9999 
    100100    my $this = shift;  
     
    103103    $this->verify_normal_attachment($topic, "afile.txt"); 
    104104    $this->verify_normal_attachment($topic, "bfile.txt"); 
    105     $this->addMissingAttachment($topic, 'bogusAttachment.txt', "I'm a figment of TWiki's imagination"); 
     105    $this->addMissingAttachment($topic, 'bogusAttachment.txt', "I'm a figment of Foswiki's imagination"); 
    106106    $this->addMissingAttachment($topic, 'ressurectedComment.txt', 'ressurected attachment comment'); 
    107107    $this->sneakAttachmentsAddedToTopic($topic, 'sneakedfile1.txt','sneakedfile2.txt', 'commavfilesshouldbeignored2.txt,v','_hiddenAttachment.txt', 'ressurectedComment.txt'); 
     
    169169    $this->assert($this->{twiki}->{store}->topicExists($this->{test_web}, $topic)); 
    170170 
    171     open( FILE, ">$TWiki::cfg{TempfileDir}/$attachment" ); 
     171    open( FILE, ">$Foswiki::cfg{TempfileDir}/$attachment" ); 
    172172    print FILE "Test attachment\n"; 
    173173    close(FILE); 
     
    179179    $this->{twiki}->{store}->saveAttachment( 
    180180        $this->{test_web}, $topic, $attachment, $this->{test_user_wikiname}, 
    181         { file => "$TWiki::cfg{TempfileDir}/$attachment", comment => 'comment 1' } ); 
    182  
    183     unlink "$TWiki::cfg{TempfileDir}/$attachment"; 
     181        { file => "$Foswiki::cfg{TempfileDir}/$attachment", comment => 'comment 1' } ); 
     182 
     183    unlink "$Foswiki::cfg{TempfileDir}/$attachment"; 
    184184 
    185185    # Check revision number 
Note: See TracChangeset for help on using the changeset viewer.