← Back to team overview

mvhub-dev team mailing list archive

[Branch ~mvhub-commit/mvhub/trunk] Rev 397: Added two unit tests login_with_bad_password and

 

Merge authors:
  Priya Ravindran (priya)
Related merge proposals:
  https://code.launchpad.net/~priya/mvhub/add_user_login_test/+merge/26088
  proposed by: Priya Ravindran (priya)
  review: Approve - Dan MacNeil (omacneil)
------------------------------------------------------------
revno: 397 [merge]
committer: Priya Ravindran <pthirumal@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-06-03 11:12:17 -0400
message:
  Added two unit tests login_with_bad_password and 
  login_with_good_password
added:
  app-mvhub/t/mech/user/login_with_bad_password.t
  app-mvhub/t/mech/user/login_with_good_password.t
modified:
  lib-mvhub/lib/MVHub/Utils/Setup.pm


--
lp:mvhub
https://code.launchpad.net/~mvhub-commit/mvhub/trunk

Your team MVHub Developers is subscribed to branch lp:mvhub.
To unsubscribe from this branch go to https://code.launchpad.net/~mvhub-commit/mvhub/trunk/+edit-subscription
=== added file 'app-mvhub/t/mech/user/login_with_bad_password.t'
--- app-mvhub/t/mech/user/login_with_bad_password.t	1970-01-01 00:00:00 +0000
+++ app-mvhub/t/mech/user/login_with_bad_password.t	2010-05-26 18:32:04 +0000
@@ -0,0 +1,104 @@
+#!/usr/bin/perl 
+
+# $Revision: 1473 $
+use strict;
+use warnings;
+
+use Test::More;
+use Test::WWW::Mechanize;
+
+BEGIN {
+    use FindBin qw($Bin);
+    chdir $Bin;
+}
+use TestHelper;
+
+{    #main
+    TestHelper::run_submit_forms_ok(
+        get_forms_sub => \&get_forms,
+        prefix        => 'nsp',
+        )
+}    # main
+
+sub get_forms {
+    my $host = shift
+        or die 'missing param: $host';
+
+    my @forms = (
+
+        #test for bad password
+        {   'url' => "http://$host/cgi-bin/mvhub/agency.pl";,
+            'expected_content' =>
+                'Incorrect password for this agency. Please try again.',
+            'number'        => '1',
+            'button'        => 'submit_login',
+            'skip_reason'   => '',
+            'tests_to_skip' => '',
+            'fields'        => {
+                'agency_password' => 'badpassword',
+                'rm'              => 'do_login',
+                'agency_id'       => '103586'
+            },
+        },
+
+        #test for no password
+        {   'url'              => "http://$host/cgi-bin/mvhub/agency.pl";,
+            'expected_content' => 'Please enter a password',
+            'number'           => '1',
+            'button'           => 'submit_login',
+            'skip_reason'      => '',
+            'tests_to_skip'    => '',
+            'fields'           => {
+                'agency_password' => '',
+                'rm'              => 'do_login',
+                'agency_id'       => '103586'
+            },
+        },
+
+        #test for good password and bad agency id
+        {   'url' => "http://$host/cgi-bin/mvhub/agency.pl";,
+            'expected_content' =>
+                'Incorrect password for this agency. Please try again.',
+            'number'        => '1',
+            'button'        => 'submit_login',
+            'skip_reason'   => '',
+            'tests_to_skip' => '',
+            'fields'        => {
+                'agency_password' => '@lunch4all',
+                'rm'              => 'do_login',
+                'agency_id'       => '1035'
+            },
+        },
+
+        #test for bad password and bad agency id
+        {   'url' => "http://$host/cgi-bin/mvhub/agency.pl";,
+            'expected_content' =>
+                'Incorrect password for this agency. Please try again.',
+            'number'        => '1',
+            'button'        => 'submit_login',
+            'skip_reason'   => '',
+            'tests_to_skip' => '',
+            'fields'        => {
+                'agency_password' => 'badpassword',
+                'rm'              => 'do_login',
+                'agency_id'       => '1035'
+            },
+        },
+
+        #test for good password and missing agency id
+        {   'url' => "http://$host/cgi-bin/mvhub/agency.pl";,
+            'expected_content' =>
+                'Incorrect password for this agency. Please try again.',
+            'number'        => '1',
+            'button'        => 'submit_login',
+            'skip_reason'   => '',
+            'tests_to_skip' => '',
+            'fields'        => {
+                'agency_password' => '@lunch4all',
+                'rm'              => 'do_login',
+            },
+        },
+
+    );    # @forms
+    return @forms;
+}

=== added file 'app-mvhub/t/mech/user/login_with_good_password.t'
--- app-mvhub/t/mech/user/login_with_good_password.t	1970-01-01 00:00:00 +0000
+++ app-mvhub/t/mech/user/login_with_good_password.t	2010-05-26 18:32:04 +0000
@@ -0,0 +1,43 @@
+#!/usr/bin/perl 
+
+# $Revision: 1473 $
+use strict;
+use warnings;
+
+use Test::More;
+use Test::WWW::Mechanize;
+
+BEGIN {
+    use FindBin qw($Bin);
+    chdir $Bin;
+}
+use TestHelper;
+
+{    #main
+    TestHelper::run_submit_forms_ok(
+        get_forms_sub => \&get_forms,
+        prefix        => 'nsp',
+        )
+}    # main
+
+sub get_forms {
+    my $host = shift
+        or die 'missing param: $host';
+
+    my @forms = (
+        {   'url'              => "http://$host/cgi-bin/mvhub/agency.pl";,
+            'expected_content' => 'Agency Account Home Page',
+            'number'           => '1',
+            'button'           => 'submit_login',
+            'skip_reason'      => '',
+            'tests_to_skip'    => '',
+            'fields'           => {
+                'agency_password' => '@lunch4all',
+                'rm'              => 'do_login',
+                'agency_id'       => '103586'
+            },
+        },
+
+    );    # @forms
+    return @forms;
+}

=== modified file 'lib-mvhub/lib/MVHub/Utils/Setup.pm'
--- lib-mvhub/lib/MVHub/Utils/Setup.pm	2010-05-28 21:22:22 +0000
+++ lib-mvhub/lib/MVHub/Utils/Setup.pm	2010-06-03 15:08:23 +0000
@@ -14,6 +14,7 @@
 use MVHub::Utils::DB;
 
 our @EXPORT_OK = qw(
+
     @SITE_CODES
     add_apache_config
     add_dns