[vhffs-dev] [409] Forgot to add webtests in my last commit

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 409
Author:   beuss
Date:     2007-01-19 07:21:44 +0000 (Fri, 19 Jan 2007)

Log Message:
-----------
Forgot to add webtests in my last commit

Added Paths:
-----------
    branches/vhffs_4.1/vhffs-tests/src/Services/Httpd.pl


Added: branches/vhffs_4.1/vhffs-tests/src/Services/Httpd.pl
===================================================================
--- branches/vhffs_4.1/vhffs-tests/src/Services/Httpd.pl	2007-01-19 01:37:31 UTC (rev 408)
+++ branches/vhffs_4.1/vhffs-tests/src/Services/Httpd.pl	2007-01-19 07:21:44 UTC (rev 409)
@@ -0,0 +1,47 @@
+use strict;
+use Vhffs::Tests::Main;
+use Vhffs::Tests::Utils;
+use Vhffs::Constants;
+use Vhffs::User;
+use Vhffs::Services::Httpd;
+use Test::More 'no_plan';
+
+my $main = init Vhffs::Tests::Main;
+isa_ok($main, 'Vhffs::Tests::Main', '$main');
+
+Vhffs::Tests::Utils::init_db($main->get_db_object);
+
+my $user1 = Vhffs::User::create($main, 'test1', 'abcdef', 0, 'test1@xxxxxxxx');
+isa_ok($user1, 'Vhffs::User', '$user1');
+
+my $group1 = Vhffs::Group::create($main, 'webgroup1', $user1->get_uid, undef, 'Test group for web');
+isa_ok($group1, 'Vhffs::Group', '$group1');
+my $group2 = Vhffs::Group::create($main, 'webgroup2', $user1->get_uid, undef, 'Test group for web');
+isa_ok($group2, 'Vhffs::Group', '$group1');
+
+my $web1 = Vhffs::Services::Httpd::create($main, 'testweb1.org', 'Test web 1', $user1, $group1);
+isa_ok($web1, 'Vhffs::Services::Httpd', '$web1');
+cmp_ok($web1->get_servername, 'eq', 'testweb1.org', 'servername is the one defined while creating object');
+cmp_ok($web1->get_owneruid, '==', $user1->get_uid, 'uid matches');
+cmp_ok($web1->get_ownergid, '==', $group1->get_gid, 'gid matches');
+
+my @webs = @{Vhffs::Services::Httpd::getall($main)};
+cmp_ok(scalar(@webs), '==', 1);
+is_deeply($webs[0], $web1);
+
+ok(!defined(Vhffs::Services::Httpd::getall($main, Vhffs::Constants::ACTIVATED)), 'No ACTIVATED webarea repo');
+
+@webs = @{Vhffs::Services::Httpd::getall_by_group($main, $group1)};
+cmp_ok(scalar(@webs), '==', 1);
+is_deeply($webs[0], $web1);
+
+ok(!defined(Vhffs::Services::Httpd::getall_by_group($main, $group2)), 'No webarea repo for group2');
+
+@webs = @{Vhffs::Services::Httpd::getall_by_letter($main, 't')};
+cmp_ok(scalar(@webs), '==', 1);
+
+# Only first letter matters
+@webs = @{Vhffs::Services::Httpd::getall_by_letter($main, 'e')};
+cmp_ok(scalar(@webs), '==', 0);
+
+


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/