Mojolicious-Plugin-RoutesAuthDBI

 view release on metacpan or  search on metacpan

t/02-schema.t  view on Meta::CPAN

  ->content_like(qr/table\s+(?:IF NOT EXISTS)?\s*"$config->{schema}"\."$config->{tables}{guests}"/i)
  ->content_like(qr/table\s+(?:IF NOT EXISTS)?\s*"$config->{schema}"\."$config->{tables}{logs}"/i)
  ;

my $create = $t->tx->res->text;


subtest 'need_conn' => sub {
  plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
    unless $ENV{TEST_CONN_PG};
  my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_CONN_PG};
  require DBI;
  my $dbh = DBI->connect($dsn, $user, $pw);
  is $dbh->do($create), '0E0', 'create schema tables';
};


#~ warn $t->tx->res->text;

done_testing();

t/04-admin.t  view on Meta::CPAN

use Mojo::Base 'Mojolicious';
use Test::More;
use Test::Mojo;
use DBI;

plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
  unless $ENV{TEST_CONN_PG};

has dbh => sub { DBI->connect(split m|[/]|, $ENV{TEST_CONN_PG}) };

my $config = do 't/config.pm';

sub startup {
  my $app = shift;
  $app->plugin('RoutesAuthDBI',
    auth=>{current_user_fn=>'auth_user'},
    admin=>{prefix=>$config->{prefix}, trust=>$config->{trust}, role_admin=>$config->{role_admin},},
    template=>$config,
  );

t/05-access.t  view on Meta::CPAN

use Mojo::Base 'Mojolicious';
use Test::More;
use Test::Mojo;
use DBI;
use lib 't';

plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
  unless $ENV{TEST_CONN_PG};

has dbh => sub { DBI->connect(split m|[/]|, $ENV{TEST_CONN_PG})};

my $config = do 't/config.pm';

sub startup {
  my $app = shift;
  $app->plugin('RoutesAuthDBI',
    auth=>{current_user_fn=>'auth_user'},
    admin=>{prefix=>$config->{prefix}, trust=>$config->{trust}, role_admin=>$config->{role_admin},},
    template=>$config,
  );

t/06-guest.t  view on Meta::CPAN

use Mojo::Base 'Mojolicious';
use Test::More;
use Test::Mojo;
use DBI;

use constant PKG => __PACKAGE__;

plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
  unless $ENV{TEST_CONN_PG};

has dbh => sub { DBI->connect(split m|[/]|, $ENV{TEST_CONN_PG}) };

my $config = do 't/config.pm';

sub startup {
  my $app = shift;
  $app->plugin('RoutesAuthDBI',
    admin=>{prefix=>$config->{prefix}, trust=>$config->{trust}, role_admin=>$config->{role_admin},},
    guest=>{},
    template=>$config,
  );

t/07-oauth.t  view on Meta::CPAN

use Mojo::Base 'Mojolicious';
use Test::More;
use Test::Mojo;
use DBI;

plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
  unless $ENV{TEST_CONN_PG};

has dbh => sub { DBI->connect(split m|[/]|, $ENV{TEST_CONN_PG}) };

my $config = do 't/config.pm';
my $pkg = __PACKAGE__;


sub startup {
  my $app = shift;
  $app->plugin('RoutesAuthDBI',
    #~ auth=>{current_user_fn=>'auth_user'},
    admin=>{prefix=>$config->{prefix}, trust=>$config->{trust}, role_admin=>$config->{role_admin},},

t/08-log.t  view on Meta::CPAN

use Mojo::Base 'Mojolicious';
use Test::More;
use Test::Mojo;
use DBI;

use constant PKG => __PACKAGE__;

plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
  unless $ENV{TEST_CONN_PG};

has dbh => sub { DBI->connect(split m|[/]|, $ENV{TEST_CONN_PG}) };

my $config = do 't/config.pm';


sub startup {
  my $app = shift;
  $app->plugin('RoutesAuthDBI',
    admin=>{prefix=>$config->{prefix}, trust=>$config->{trust}, role_admin=>$config->{role_admin},},
    log=>{},
    template=>$config,

t/99-drop.t  view on Meta::CPAN

  ->status_is(200)
  ->content_like(qr/drop schema "$config->{schema}"/i)
  ->content_like(qr/drop sequence $config->{sequence}/i)
  ;

#~ warn $t->tx->res->text;

subtest 'need_conn' => sub {
  plan skip_all => 'set env TEST_CONN_PG="DBI:Pg:dbname=<db>/<pg_user>/<passwd>" to enable this test'
    unless $ENV{TEST_CONN_PG};
  my ($dsn, $user, $pw) = split m|[/]|, $ENV{TEST_CONN_PG};
  require DBI;
  my $dbh = DBI->connect($dsn, $user, $pw);
  is $dbh->do($t->tx->res->text), '0E0', 'done';
};


#~ warn $t->tx->res->text;

done_testing();



( run in 3.263 seconds using v1.01-cache-2.11-cpan-71847e10f99 )