Skip to content

Commit

Permalink
Test: clean groups (#2102)
Browse files Browse the repository at this point in the history
* test: do not clean groups when no table created

* refactor: faster post login
  • Loading branch information
frankiejol authored Oct 9, 2024
1 parent 88a3e8f commit ea89719
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Ravada/Request.pm
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ our %COMMAND = (
,commands => ['shutdown','shutdown_now', 'enforce_limits', 'set_time'
,'remove_domain', 'remove', 'refresh_machine_ports'
,'connect_node','start_node','shutdown_node'
,'post_login'
]
}

Expand Down
7 changes: 6 additions & 1 deletion t/lib/Test/Ravada.pm
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,12 @@ sub _clean_old_users() {
}

sub _clean_old_groups() {
my $sth = $CONNECTOR->dbh->prepare("SELECT id,name FROM groups_local WHERE name like ? ");
my $sth = $CONNECTOR->dbh->table_info('%',undef,'groups_local','TABLE');
my $info = $sth->fetchrow_hashref();
$sth->finish;
return if !keys %$info;

$sth = $CONNECTOR->dbh->prepare("SELECT id,name FROM groups_local WHERE name like ? ");
$sth->execute(base_domain_name().'%');
while ( my ($id,$name) = $sth->fetchrow ) {
my $g = Ravada::Auth::Group->open($id);
Expand Down
1 change: 1 addition & 0 deletions t/mojo/40_anonymous.t
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,5 @@ wait_request();
remove_volatile_clones(@$bases);

remove_old_domains_req(0);
end();
done_testing();
1 change: 1 addition & 0 deletions t/mojo/40_security_policy.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ $sth->execute($settings->{frontend}->{content_security_policy}->{id});
$new->{frontend}->{content_security_policy}->{'default-src'}->{value} = '';
$new->{frontend}->{content_security_policy}->{'all'}->{value} = '';
$t->post_ok("/settings_global", json => $new );
end();
done_testing();

0 comments on commit ea89719

Please sign in to comment.