TT#35702 Fix broken cert files for test_machine from fake_data

Fake_data keeps own test_machine, and when we change user
 using runas in other test_machine instance - we need to
reinit cert files before request.

Change-Id: Idddeef2b0c10521c71ce5d77c5010f89c620185c
changes/03/20403/2
Irina Peshinskaya 8 years ago
parent e1e2613684
commit 58fabf41d5

@ -60,6 +60,18 @@ SKIP:
{
my ($res,$sub1,$cf_collection1,$cft_collection1,$cf_collection2,$cft_collection2);
{#todo: move to fake_data
my $reseller_admin = $test_machine->get_item_hal('admins','/api/admins/?login=api_test');
if (!(exists $reseller_admin->{total_count} && $reseller_admin->{total_count})) {
$fake_data->test_machine($test_machine);#because we removed shared certs when runas admin
my $data = $fake_data->process('admins');
$data->{login} = 'api_test';
$data->{password} = 'api_test';
my($res,$content) = $test_machine->request_post($data, '/api/admins/');
$test_machine->http_code_msg(201, "create reseller",$res,$content);
$test_machine->set_reseller_credentials($data);
}
}
$test_machine->runas('reseller');
($res, $cf_collection1) = $test_machine->request_get('/api/cfdestinationsets/?page=1&rows=10');
@ -129,6 +141,7 @@ SKIP:
$test_machine->http_code_msg(422, "Check announcement_id from other group", $res, $content);
}
$test_machine->runas('admin');
$fake_data->clear_test_data_all();
$test_machine->clear_test_data_all();
undef $fake_data;

@ -398,6 +398,7 @@ if (!$remote_config->{config}->{features}->{cloudpbx}) {
$test_machine->runas('admin');
}
}
$test_machine->runas('admin');
#TT#8680
{

@ -302,10 +302,9 @@ sub init_ssl_cert {
return;
}
lock $tmpfilename;
unless ($tmpfilename) {
unless ($tmpfilename && -e $tmpfilename) {
my $_ua = $ua // $self->_create_ua(0);
my $res = $_ua->post(
$self->base_uri . '/api/admincerts/',
Content_Type => 'application/json',
Content => '{}'
@ -664,6 +663,7 @@ sub request{
print "$curl\n\n";
}
if(!$self->DEBUG_ONLY){
$self->init_ssl_cert($self->ua, $self->runas_role);
my $res = $self->ua->request($req);
diag(sprintf($self->name_prefix."request:%s: %s", $req->method, $req->uri));
#draft of the debug mode

Loading…
Cancel
Save