You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
301 lines
6.8 KiB
301 lines
6.8 KiB
---
|
|
#check options
|
|
-
|
|
name: check OPTIONS for trustedsources
|
|
type: item
|
|
method: OPTIONS
|
|
path: /api/trustedsources/
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
header:
|
|
Accept-Post: application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-trustedsources
|
|
ok:
|
|
options:
|
|
- GET
|
|
- HEAD
|
|
- OPTIONS
|
|
- POST
|
|
|
|
#create test domain
|
|
-
|
|
name: create test domain
|
|
type: item
|
|
method: POST
|
|
path: /api/domains/
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
domain: test${unique_id}.example.org
|
|
reseller_id: 1
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
retain:
|
|
domain_path: header.location
|
|
domain_id: header.location
|
|
|
|
#create a BillingProfile
|
|
-
|
|
name: create a BillingProfile
|
|
type: item
|
|
method: POST
|
|
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:
|
|
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
|
|
retain:
|
|
customer_contact_path: header.location
|
|
customer_contact_id: header.location
|
|
|
|
#get CustomerContact
|
|
-
|
|
name: check CustomerContact
|
|
type: item
|
|
method: GET
|
|
path: '/${customer_contact_path}'
|
|
retain:
|
|
customer_contact: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
$retained->{customer_type} = 'sipaccount';
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#create Customer
|
|
-
|
|
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
|
|
};
|
|
}
|
|
|
|
#create Subscriber
|
|
-
|
|
name: include create Subscriber
|
|
type: include
|
|
file: CreateSubscriber.yaml
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
|
|
my $cc = 800;
|
|
my $ac = '1';
|
|
my $sn = $retained->{unique_id};
|
|
$retained->{subscriber_content} = {
|
|
primary_number => { cc => $cc, ac => $ac, sn => $sn },
|
|
domain_id => $retained->{domain_id},
|
|
username => 'subscriber_' . '1' . '_'.$retained->{unique_id},
|
|
password => 'subscriber_password',
|
|
customer_id => $retained->{customer}->{id},
|
|
};
|
|
}
|
|
|
|
#create trustedsources
|
|
-
|
|
name: create trustedsources
|
|
type: item
|
|
method: POST
|
|
path: '/api/trustedsources/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
subscriber_id: ${subscriber_id}
|
|
protocol: 'UDP'
|
|
src_ip: '203.0.113.42'
|
|
from_pattern: '^sip:test@example.org'
|
|
retain:
|
|
trustedsources_path1: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#create trustedsources
|
|
-
|
|
name: create trustedsources
|
|
type: item
|
|
method: POST
|
|
path: '/api/trustedsources/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
subscriber_id: ${subscriber_id}
|
|
protocol: 'UDP'
|
|
src_ip: '203.0.113.43'
|
|
from_pattern: '^sip:test@example.org'
|
|
retain:
|
|
trustedsources_path2: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#create trustedsources
|
|
-
|
|
name: create trustedsources
|
|
type: item
|
|
method: POST
|
|
path: '/api/trustedsources/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
subscriber_id: ${subscriber_id}
|
|
protocol: 'UDP'
|
|
src_ip: '203.0.113.44'
|
|
from_pattern: '^sip:test@example.org'
|
|
retain:
|
|
trustedsources_path3: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#verify pagination
|
|
-
|
|
name: verify pagination
|
|
type: pagination
|
|
method: GET
|
|
path: '/api/trustedsources/?page=1&rows=2'
|
|
retain:
|
|
collection: body
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#check options on item
|
|
-
|
|
name: check OPTIONS for trustedsources item
|
|
type: item
|
|
method: OPTIONS
|
|
path: '/${trustedsources_path3}'
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
ok:
|
|
options:
|
|
- GET
|
|
- HEAD
|
|
- OPTIONS
|
|
- PUT
|
|
- PATCH
|
|
- DELETE
|
|
|
|
#get trustedsources
|
|
-
|
|
name: GET trustedsources
|
|
type: item
|
|
method: GET
|
|
path: '/${trustedsources_path3}'
|
|
retain:
|
|
trustedsources: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
delete $retained->{trustedsources}->{_links};
|
|
delete $retained->{trustedsources}->{_embedded};
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#put trustedsources
|
|
-
|
|
name: PUT trustedsources
|
|
type: item
|
|
method: PUT
|
|
path: '/${trustedsources_path3}'
|
|
header:
|
|
Content-Type: application/json
|
|
Prefer: return=representation
|
|
content: '${trustedsources}'
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#get trustedsources
|
|
-
|
|
name: GET trustedsources
|
|
type: item
|
|
method: GET
|
|
path: '/${trustedsources_path3}'
|
|
retain:
|
|
new_trustedsources: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
delete $retained->{new_trustedsources}->{_links};
|
|
delete $retained->{new_trustedsources}->{_embedded};
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
is_deeply:
|
|
'${trustedsources}': ${new_trustedsources}
|
|
|
|
#DELETE trustedsources
|
|
-
|
|
name: DELETE trustedsources
|
|
type: item
|
|
method: DELETE
|
|
path: '/${trustedsources_path1}'
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#DELETE trustedsources
|
|
-
|
|
name: DELETE trustedsources
|
|
type: item
|
|
method: DELETE
|
|
path: '/${trustedsources_path2}'
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#DELETE trustedsources
|
|
-
|
|
name: DELETE trustedsources
|
|
type: item
|
|
method: DELETE
|
|
path: '/${trustedsources_path3}'
|
|
conditions:
|
|
is:
|
|
code: 204
|