[LON-CAPA-cvs] cvs: modules /jerf/tests utils_courseTest.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Tue, 01 Jul 2003 20:13:43 -0000
bowersj2 Tue Jul 1 16:13:43 2003 EDT
Added files:
/modules/jerf/tests utils_courseTest.pm
Log:
Test course infrastucture to make sure creation and deletion work
correctly.
Index: modules/jerf/tests/utils_courseTest.pm
+++ modules/jerf/tests/utils_courseTest.pm
# The LearningOnline Network with CAPA
# testing the course object
#
# $Id: utils_courseTest.pm,v 1.1 2003/07/01 20:13:43 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
# (Testing: testing the course object
use lib '.';
use lib '/home/httpd/lib/perl/';
package utils_userTest;
use base qw(Test::Unit::TestCase);
use strict;
use Data::Dumper;
use Utils;
use Data;
use ApacheRequest;
sub new {
my $self = shift()->SUPER::new(@_);
return $self;
}
sub set_up {
my $self = shift;
}
sub tear_down {
my $self = shift;
}
sub test_basic_creation_and_deletion {
my $self = shift;
# Test *basic* creation and deletion
# Log a user in create the course
my $user = Utils::User->new($Data::testDomain, $Data::dcName,
$Data::dcPassword);
my $r = ApacheRequest->new({user=>$user});
$user->login($r);
$user->selectRoleDC($r);
# Now create a new course
my $course = Utils::Course->new($r, "Test Course, should never see this", '',
$Data::dcName);
$self->assert($course->{courseId}); # having this pretty much guarentees it worked
my $courseDir = $course->courseDirectory();
$self->assert($courseDir);
# Fortunately, assigning the CC role to the DC and checking the
# "Immediately expire own role as DC" does remove the DC role, so
# we don't need to futz with that now
# assert the directory exists
$self->assert(-e $courseDir);
# Delete the course
$course->delete();
$self->assert(!defined($course));
$self->assert(!-e $courseDir);
}
1;
__END__