[Rt-commit] rt branch, master, updated. rt-3.9.7-1168-g0286dbb
? sunnavy
sunnavy at bestpractical.com
Fri Jan 7 02:55:30 EST 2011
The branch, master has been updated
via 0286dbb63c8e46214d560e272a82b52fccf1eca4 (commit)
from 4af89b550a672a3f5c6b5337d879b3a41162837d (commit)
Summary of changes:
t/web/install.t | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 150 insertions(+), 0 deletions(-)
create mode 100644 t/web/install.t
- Log -----------------------------------------------------------------
commit 0286dbb63c8e46214d560e272a82b52fccf1eca4
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Jan 7 15:54:24 2011 +0800
tests for /Install/
diff --git a/t/web/install.t b/t/web/install.t
new file mode 100644
index 0000000..c37a270
--- /dev/null
+++ b/t/web/install.t
@@ -0,0 +1,150 @@
+use strict;
+use warnings;
+use File::Spec;
+use utf8;
+use RT::Test tests => 57, actual_server => 1, noinitialdata => 1;
+RT->InstallMode(1);
+
+my $dbname = 'rt4test_install_xxx';
+my $rtname = 'rttestname';
+my $domain = 'rttes.com';
+my $password = 'newpass';
+my $correspond = 'reply at example.com';
+my $comment = 'comment at example.com';
+
+unlink File::Spec->catfile( $RT::VarPath, $dbname );
+
+my ( $url, $m ) = RT::Test->started_ok;
+my ($port) = $url =~ /:(\d+)/;
+$m->get_ok($url);
+
+is( $m->uri, $url . '/Install/index.html', 'install page' );
+$m->select( 'Lang', 'zh-cn' );
+$m->click('ChangeLang');
+$m->content_contains( 'è¯è¨', 'select chinese' );
+
+$m->click('Run');
+$m->content_contains( 'æ°æ®åº', 'select db type in chinese' );
+
+$m->back;
+$m->select( 'Lang', 'en' );
+$m->click('ChangeLang');
+$m->content_contains( 'Select another language', 'back to english' );
+
+$m->click('Run');
+
+is( $m->uri, $url . '/Install/DatabaseType.html', 'db type page' );
+my $select_type = $m->current_form->find_input('DatabaseType');
+my @possible_types = $select_type->possible_values;
+ok( @possible_types, 'we have at least 1 db type' );
+
+SKIP: {
+ skip 'no mysql found', 7 unless grep { /mysql/ } @possible_types;
+ $m->select( 'DatabaseType', 'mysql' );
+ $m->click;
+ for my $field (qw/Name Host Port Admin AdminPassword User Password/) {
+ ok( $m->current_form->find_input("Database$field"),
+ "db mysql has field Database$field" );
+ }
+ $m->back;
+}
+
+SKIP: {
+ skip 'no pg found', 8 unless grep { /Pg/ } @possible_types;
+ $m->select( 'DatabaseType', 'Pg' );
+ $m->click;
+ for my $field (
+ qw/Name Host Port Admin AdminPassword User Password RequireSSL/)
+ {
+ ok( $m->current_form->find_input("Database$field"),
+ "db Pg has field Database$field" );
+ }
+ $m->back;
+}
+
+$m->select( 'DatabaseType', 'SQLite' );
+$m->click;
+
+is( $m->uri, $url . '/Install/DatabaseDetails.html', 'db details page' );
+$m->field( 'DatabaseName' => $dbname );
+$m->submit_form( fields => { DatabaseName => $dbname } );
+$m->content_contains( 'Connection succeeded', 'succeed msg' );
+$m->content_contains(
+qq{$dbname already exists, but does not contain RT's tables or metadata. The 'Initialize Database' step later on can insert tables and metadata into this existing database. if this is acceptable, click 'Customize Basic' below to continue customizing RT.},
+ 'more db state msg'
+);
+$m->click;
+
+is( $m->uri, $url . '/Install/Basics.html', 'basics page' );
+$m->click;
+$m->content_contains(
+ 'You must enter an Administrative password',
+ "got password can't be empty error"
+);
+
+for my $field (qw/rtname WebDomain WebPort Password/) {
+ ok( $m->current_form->find_input($field), "has field $field" );
+}
+is( $m->value('WebPort'), $port, 'default port' );
+$m->field( 'rtname' => $rtname );
+$m->field( 'WebDomain' => $domain );
+$m->field( 'Password' => $password );
+$m->click;
+
+is( $m->uri, $url . '/Install/Sendmail.html', 'mail page' );
+$m->click;
+$m->content_contains( "doesn't look like an email address",
+ 'got email error' );
+for my $field (qw/SendmailPath OwnerEmail/) {
+ ok( $m->current_form->find_input($field), "has field $field" );
+}
+$m->field( 'OwnerEmail' => 'root at localhost' );
+$m->click;
+
+is( $m->uri, $url . '/Install/Global.html', 'global page' );
+for my $field (qw/CommentAddress CorrespondAddress/) {
+ ok( $m->current_form->find_input($field), "has field $field" );
+}
+
+$m->click;
+is( $m->uri, $url . '/Install/Initialize.html', 'init db page' );
+$m->back;
+
+is( $m->uri, $url . '/Install/Global.html', 'global page' );
+$m->field( 'CorrespondAddress' => 'reply' );
+$m->click;
+$m->content_contains( "doesn't look like an email address",
+ 'got email error' );
+$m->field( 'CommentAddress' => 'comment' );
+$m->click;
+$m->content_contains( "doesn't look like an email address",
+ 'got email error' );
+
+$m->field( 'CorrespondAddress' => 'reply at example.com' );
+$m->field( 'CommentAddress' => 'comment at example.com' );
+$m->click;
+
+is( $m->uri, $url . '/Install/Initialize.html', 'init db page' );
+$m->click;
+
+is( $m->uri, $url . '/Install/Finish.html', 'finish page' );
+$m->click;
+
+is( $m->uri, $url . '/', 'home page' );
+$m->login( 'root', $password );
+$m->content_contains( 'RT at a glance', 'logged in with newpass' );
+
+RT->LoadConfig;
+my $config = RT->Config;
+
+is( $config->Get('DatabaseType'), 'SQLite', 'DatabaseType in config' );
+is( $config->Get('DatabaseName'), $dbname, 'DatabaseName in config' );
+is( $config->Get('rtname'), $rtname, 'rtname in config' );
+is( $config->Get('WebDomain'), $domain, 'WebDomain email in config' );
+is( $config->Get('WebPort'), $port, 'WebPort email in config' );
+is( $config->Get('CorrespondAddress'),
+ $correspond, 'correspond address in config' );
+is( $config->Get('CommentAddress'), $comment, 'comment address in config' );
+
+unlink File::Spec->catfile( $RT::VarPath, $dbname );
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list