← Back to team overview

mvhub-dev team mailing list archive

[Merge] lp:~omacneil/mvhub/fix_passwd_test into lp:mvhub

 

Dan MacNeil has proposed merging lp:~omacneil/mvhub/fix_passwd_test into lp:mvhub.

Requested reviews:
  MVHub devs with commit rights (mvhub-commit)


see commit log, part of a series of fixes to tests that falsely fail on staging server with production data

---not to be confused with other 'password' branch merge request which is somewhat misleadingly named. 
-- 
https://code.launchpad.net/~omacneil/mvhub/fix_passwd_test/+merge/29233
Your team MVHub Developers is subscribed to branch lp:mvhub.
=== modified file 'app-mvhub/conf/sql_select.lib'
--- app-mvhub/conf/sql_select.lib	2010-07-03 16:28:30 +0000
+++ app-mvhub/conf/sql_select.lib	2010-07-05 19:15:45 +0000
@@ -372,6 +372,11 @@
 FROM agency 
 WHERE agency_id = ?
 
+[AGENCY_X_PASSWORD]
+SELECT password
+FROM agency
+WHERE agency_id= ?
+
 [AGENCY_X_PROGRAM_NAME_AGENCY_NAME_DATE_CREATED]
 SELECT p.program_name, a.agency_name, p.date_created
 FROM agency a, program p 

=== modified file 'app-mvhub/t/mech/user/login_with_good_password.t'
--- app-mvhub/t/mech/user/login_with_good_password.t	2010-05-26 18:32:04 +0000
+++ app-mvhub/t/mech/user/login_with_good_password.t	2010-07-05 19:15:45 +0000
@@ -4,15 +4,15 @@
 use strict;
 use warnings;
 
+use Params::Validate;
+
 use Test::More;
 use Test::WWW::Mechanize;
 
-BEGIN {
-    use FindBin qw($Bin);
-    chdir $Bin;
-}
 use TestHelper;
 
+use MVHub::Utils::DB;
+
 {    #main
     TestHelper::run_submit_forms_ok(
         get_forms_sub => \&get_forms,
@@ -32,7 +32,7 @@
             'skip_reason'      => '',
             'tests_to_skip'    => '',
             'fields'           => {
-                'agency_password' => '@lunch4all',
+                'agency_password' => _get_password(103586),
                 'rm'              => 'do_login',
                 'agency_id'       => '103586'
             },
@@ -41,3 +41,18 @@
     );    # @forms
     return @forms;
 }
+
+sub _get_password{
+  Params::Validate::validate_pos(@_,1);
+  my $agency_id=shift;
+  my $dbh=MVHub::Utils::DB::get_dbh($ENV{MV_CONFIG_FILE});
+
+  my $sql=MVHub::Utils::DB::get_sql_select_statement('AGENCY_X_PASSWORD');
+  my @bind_values=($agency_id);
+  my $aref = $dbh->selectall_arrayref( $sql, {Slice=>{}}, @bind_values);
+  my $password= $aref->[0]{password};
+  
+  return $password;
+  
+  
+}

=== modified file 'app-mvhub/t/sql_lib_sanity.t'
--- app-mvhub/t/sql_lib_sanity.t	2010-06-29 19:21:04 +0000
+++ app-mvhub/t/sql_lib_sanity.t	2010-07-05 19:15:45 +0000
@@ -60,6 +60,7 @@
             '[[:<:]](ymca|counsel|immi|shelter)[[:>:]]'
         ],
         'AGENCY_X_WEBSITE'                          => [103553],
+        'AGENCY_X_PASSWORD'                         =>[103586],
         'AGENCY_PROGRAM_X_AGENCY_NAME_AGENCY_ALIAS' => [510296],
         'AGENCY_X_LAST_UPDATED'                     => [103553],
         'ALIAS_X_ALIAS_NAME'                        => [1],


Follow ups