Commit ee764371 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

[#235] create admin user after create table

parent 56beed8d
sql:
- ../../sql/sqlite/bases.sql
- ../../sql/sqlite/iso_images.sql
- ../../sql/sqlite/insert_iso_dsl.sql
- ../../sql/sqlite/domains.sql
......
use warnings;
use strict;
use Carp qw(confess);
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request;
use IPC::Run3;
use Test::More;
use Test::SQL::Data;
use lib 't/lib';
use Test::Ravada;
my $test = Test::SQL::Data->new(config => 't/etc/sql_bare.conf');
use_ok('Ravada');
my $iso;
ok(rvd_back($test->connector), "Expecting rvd_back");
eval { $iso = rvd_front->list_iso_images() };
is($@,'');
ok(scalar @$iso,"Expecting ISOs, got :".Dumper($iso));
done_testing();
......@@ -87,13 +87,15 @@ sub new_pool_name {
sub rvd_back {
my ($connector, $config) = @_;
init($connector,$config) if $connector;
init($connector,$config,0) if $connector;
return Ravada->new(
my $rvd = Ravada->new(
connector => $CONNECTOR
, config => ( $CONFIG or $DEFAULT_CONFIG)
, warn_error => 0
);
$USER_ADMIN = create_user('admin','admin',1) if !$USER_ADMIN;
return $rvd;
}
sub rvd_front {
......@@ -105,13 +107,16 @@ sub rvd_front {
}
sub init {
($CONNECTOR,$CONFIG) = @_;
my $create_user;
($CONNECTOR, $CONFIG, $create_user) = @_;
$create_user = 1 if !defined $create_user;
confess "Missing connector : init(\$connector,\$config)" if !$CONNECTOR;
$Ravada::CONNECTOR = $CONNECTOR if !$Ravada::CONNECTOR;
Ravada::Auth::SQL::_init_connector($CONNECTOR);
$USER_ADMIN = create_user('admin','admin',1);
$USER_ADMIN = create_user('admin','admin',1) if $create_user;
$Ravada::Domain::MIN_FREE_MEMORY = 512*1024;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment