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

wip(test): remove tes ldap users after tests

issue #922
parent cfa73fa1
......@@ -63,6 +63,7 @@ our $DEFAULT_DB_CONFIG = "t/etc/sql.conf";
our $CONT = 0;
our $CONT_POOL= 0;
our $USER_ADMIN;
our @USERS_LDAP;
our $CHAIN = 'RAVADA';
our $RVD_BACK;
......@@ -543,6 +544,8 @@ sub create_ldap_user($name, $password) {
eval { $user = Ravada::Auth::LDAP::add_user($name,$password) };
is($@,'') or return;
push @USERS_LDAP,($name);
my @user = Ravada::Auth::LDAP::search_user($name);
return $user[0];
}
......@@ -746,6 +749,15 @@ sub remove_old_user {
my $sth = $CONNECTOR->dbh->prepare("DELETE FROM users WHERE name=?");
$sth->execute(base_domain_name());
}
sub remove_old_user_ldap {
for my $name (@USERS_LDAP ) {
if ( Ravada::Auth::LDAP::search_user($name) ) {
Ravada::Auth::LDAP::remove_user($name)
}
}
}
sub search_id_iso {
my $name = shift;
connector() if !$CONNECTOR;
......@@ -1194,9 +1206,9 @@ sub connector {
return $connector;
}
sub DESTROY {
sub END {
remove_old_user() if $CONNECTOR;
_clean_file_config();
remove_old_user_ldap() if $CONNECTOR;
}
1;
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