TT#56467 - Fixes for Test Framework

* change threads number to 2 as
	   it temporarily fixes the 403 error
	   for the first two test cases
	 * add creating of contract in test
	   case SubscriberRegistration because
	   fetchig an existing one would fail

Change-Id: I5f27c01f39f8611004618feebc9ed1b6a7ee8066
changes/56/33056/4
Flaviu Mates 6 years ago
parent 42473db9d7
commit a4d7fa7a91

@ -38,26 +38,68 @@
ok: ok:
'${domain}.id': defined '${domain}.id': defined
#get a customer for testing #create a BillingProfile
- -
name: get a customer for testing name: create a BillingProfile
type: item type: item
method: GET method: POST
path: '/api/customers/?page=1&rows=1&order_by=id&order_by_direction=desc' path: /api/billingprofiles/
header:
Content-Type: application/json
Prefer: return=representation
content:
name: test profile ${unique_id}
handle: test_profile_handle${unique_id}
reseller_id: 1
conditions:
is:
code: 201
retain: retain:
customer: body billing_profile_id: header.location
#create a Customer Contact
-
name: create a Customer Contact
type: item
method: POST
path: /api/customercontacts/
header:
Content-Type: application/json
content:
firstname: cust_contact_first
lastname: cust_contact_last
email: cust_contact@custcontact.invalid
reseller_id: 1
conditions:
is:
code: 201
perl_code: !!perl/code | perl_code: !!perl/code |
{ {
my ($retained) = @_; my ($retained) = @_;
my $customer = $retained->{customer}->{'_embedded'}->{'ngcp:customers'}->[0]; $retained->{customer_type} = 'sipaccount';
$retained->{customer} = $customer; }
$retained->{customer_id} = $customer->{id}; retain:
} customer_contact_path: header.location
conditions: customer_contact_id: header.location
is:
code: 200 #create Customer
ok: -
'${customer}.id': defined name: include create Customer
type: include
file: CreateCustomer.yaml
perl_code: !!perl/code |
{
my ($retained) = @_;
$retained->{customer_content} = {
status => 'active',
contact_id => $retained->{customer_contact_id},
billing_profile_id => $retained->{billing_profile_id},
type => 'sipaccount',
max_subscribers => undef,
external_id => undef
};
}
#get a subscriberprofile for testing #get a subscriberprofile for testing
- -
@ -73,6 +115,7 @@
my $subscriberprofile = $retained->{subscriberprofile}->{'_embedded'}->{'ngcp:subscriberprofiles'}->[0]; my $subscriberprofile = $retained->{subscriberprofile}->{'_embedded'}->{'ngcp:subscriberprofiles'}->[0];
$retained->{subscriberprofile} = $subscriberprofile; $retained->{subscriberprofile} = $subscriberprofile;
$retained->{subscriberprofile_id} = $subscriberprofile->{id}; $retained->{subscriberprofile_id} = $subscriberprofile->{id};
$retained->{customer_id} = $retained->{customer}->{id};
} }
conditions: conditions:
is: is:

@ -53,7 +53,7 @@ for ( @test_files ) {
$tests_queue->end(); $tests_queue->end();
for (1..4) { for (1..2) {
push @threads, threads->create( {'context' => 'scalar'}, \&worker, $tests_queue, 0 ); push @threads, threads->create( {'context' => 'scalar'}, \&worker, $tests_queue, 0 );
} }

Loading…
Cancel
Save