From 86213e94d0086254436813c729103d837ab8148e Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sat, 25 Jan 2014 17:35:42 +0100 Subject: [PATCH] tous les tests utilisent initco --- t/get_all_domains.pl | 20 ++------------------ t/get_all_users.pl | 20 ++------------------ t/get_domains.pl | 20 ++------------------ 3 files changed, 6 insertions(+), 54 deletions(-) diff --git a/t/get_all_domains.pl b/t/get_all_domains.pl index c105189..fdc4f2f 100755 --- a/t/get_all_domains.pl +++ b/t/get_all_domains.pl @@ -10,30 +10,14 @@ use Data::Dump qw( dump ); use lib '../'; use app::app; - -sub initco { - - my $cfg = new Config::Simple('./config.ini'); - my $app = app->new( zdir => $cfg->param('zones_path'), - dbname => $cfg->param('dbname'), - dbhost => $cfg->param('host'), - dbport => $cfg->param('port'), - dbuser => $cfg->param('user'), - dbpass => $cfg->param('passwd'), - sgbd => $cfg->param('sgbd'), - dnsapp => $cfg->param('dnsapp') ); - - $app->init(); - - return $app; -} +use initco; if( @ARGV != 0 ) { say "usage : ./get_all_domains.pl"; exit 1; } -my $app = initco(); +my $app = initco::initco(); my %domains = $app->get_all_domains(); diff --git a/t/get_all_users.pl b/t/get_all_users.pl index b422c33..7c8d9f4 100755 --- a/t/get_all_users.pl +++ b/t/get_all_users.pl @@ -10,30 +10,14 @@ use Data::Dump qw( dump ); use lib '../'; use app::app; - -sub initco { - - my $cfg = new Config::Simple('./config.ini'); - my $app = app->new( zdir => $cfg->param('zones_path'), - dbname => $cfg->param('dbname'), - dbhost => $cfg->param('host'), - dbport => $cfg->param('port'), - dbuser => $cfg->param('user'), - dbpass => $cfg->param('passwd'), - sgbd => $cfg->param('sgbd'), - dnsapp => $cfg->param('dnsapp') ); - - $app->init(); - - return $app; -} +use initco; if( @ARGV != 0 ) { say "usage : ./get_all_domains.pl"; exit 1; } -my $app = initco(); +my $app = initco::initco(); my %users = $app->get_all_users(); diff --git a/t/get_domains.pl b/t/get_domains.pl index 6cec119..cba903d 100755 --- a/t/get_domains.pl +++ b/t/get_domains.pl @@ -10,30 +10,14 @@ use Data::Dump qw( dump ); use lib '../'; use app::app; - -sub initco { - - my $cfg = new Config::Simple('./config.ini'); - my $app = app->new( zdir => $cfg->param('zones_path'), - dbname => $cfg->param('dbname'), - dbhost => $cfg->param('host'), - dbport => $cfg->param('port'), - dbuser => $cfg->param('user'), - dbpass => $cfg->param('passwd'), - sgbd => $cfg->param('sgbd'), - dnsapp => $cfg->param('dnsapp') ); - - $app->init(); - - return $app; -} +use initco; if( @ARGV < 2) { say "usage : ./auth.pl login mdp"; exit 1; } -my $app = initco(); +my $app = initco::initco(); my ($auth_ok, $user, $isadmin) = $app->auth($ARGV[0], $ARGV[1]); if($auth_ok) {