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.
420 lines
10 KiB
420 lines
10 KiB
---
|
|
#check options
|
|
-
|
|
name: check OPTIONS for subscriberregistrations
|
|
type: item
|
|
method: OPTIONS
|
|
path: /api/subscriberregistrations/
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
header:
|
|
Accept-Post: application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-subscriberregistrations
|
|
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 subscriberregistrations
|
|
-
|
|
name: create subscriberregistrations
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_1
|
|
subscriber_id: ${subscriber_id}
|
|
q: '0.5'
|
|
expires: '2019-09-03 12:00:00'
|
|
retain:
|
|
subscriberregistrations_path1: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#create subscriberregistrations
|
|
-
|
|
name: create subscriberregistrations
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_2
|
|
subscriber_id: ${subscriber_id}
|
|
q: '0.5'
|
|
expires: '2019-09-03 12:00:00'
|
|
enabled: 1
|
|
retain:
|
|
subscriberregistrations_path2: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#create subscriberregistrations
|
|
-
|
|
name: create subscriberregistrations
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_3
|
|
subscriber_id: ${subscriber_id}
|
|
q: '0.5'
|
|
expires: '2019-09-03 12:00:00'
|
|
retain:
|
|
subscriberregistrations_path3: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#verify pagination
|
|
-
|
|
name: verify pagination
|
|
type: pagination
|
|
method: GET
|
|
path: '/api/subscriberregistrations/?page=1&rows=2'
|
|
retain:
|
|
collection: body
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#check options on item
|
|
-
|
|
name: check OPTIONS for subscriberregistrations item
|
|
type: item
|
|
method: OPTIONS
|
|
path: '/${subscriberregistrations_path3}'
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
ok:
|
|
options:
|
|
- GET
|
|
- HEAD
|
|
- OPTIONS
|
|
- PUT
|
|
- PATCH
|
|
- DELETE
|
|
|
|
#DELETE subscriberregistrations
|
|
-
|
|
name: DELETE subscriberregistrations
|
|
type: item
|
|
method: DELETE
|
|
path: '/${subscriberregistrations_path1}'
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#DELETE subscriberregistrations
|
|
-
|
|
name: DELETE subscriberregistrations
|
|
type: item
|
|
method: DELETE
|
|
path: '/${subscriberregistrations_path2}'
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#DELETE subscriberregistrations
|
|
-
|
|
name: DELETE subscriberregistrations
|
|
type: item
|
|
method: DELETE
|
|
path: '/${subscriberregistrations_path3}'
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#create subscriberregistrations
|
|
-
|
|
name: create subscriberregistrations
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_4
|
|
subscriber_id: ${subscriber_id}
|
|
q: '0.5'
|
|
expires: '2019-09-03 12:00:00'
|
|
retain:
|
|
subscriberregistrations_path4: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#get subscriberregistrations
|
|
-
|
|
name: GET subscriberregistrations
|
|
type: item
|
|
method: GET
|
|
path: '/${subscriberregistrations_path4}'
|
|
retain:
|
|
subscriberregistrations: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
delete $retained->{subscriberregistrations}->{_links};
|
|
delete $retained->{subscriberregistrations}->{_embedded};
|
|
delete $retained->{subscriberregistrations}->{id};
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#put subscriberregistrations
|
|
-
|
|
name: PUT subscriberregistrations
|
|
type: item
|
|
method: PUT
|
|
path: '/${subscriberregistrations_path4}'
|
|
header:
|
|
Content-Type: application/json
|
|
Prefer: return=representation
|
|
content: '${subscriberregistrations}'
|
|
retain:
|
|
subscriberregistrations_path_updated: header.location
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
|
|
#get subscriberregistrations
|
|
-
|
|
name: GET subscriberregistrations
|
|
type: item
|
|
method: GET
|
|
path: '/${subscriberregistrations_path_updated}'
|
|
retain:
|
|
new_subscriberregistrations: body
|
|
perl_code: !!perl/code |
|
|
{
|
|
my ($retained) = @_;
|
|
delete $retained->{new_subscriberregistrations}->{_links};
|
|
delete $retained->{new_subscriberregistrations}->{_embedded};
|
|
delete $retained->{new_subscriberregistrations}->{id};
|
|
delete $retained->{new_subscriberregistrations}->{expires};
|
|
delete $retained->{subscriberregistrations}->{expires};
|
|
}
|
|
conditions:
|
|
is:
|
|
code: 200
|
|
is_deeply:
|
|
'${subscriberregistrations}': ${new_subscriberregistrations}
|
|
|
|
#DELETE subscriberregistrations
|
|
-
|
|
name: DELETE subscriberregistrations
|
|
type: item
|
|
method: DELETE
|
|
path: '/${subscriberregistrations_path_updated}'
|
|
conditions:
|
|
is:
|
|
code: 204
|
|
|
|
#create subscriberregistrations with q > 1
|
|
-
|
|
name: create subscriberregistrations with q > 1
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_5
|
|
subscriber_id: ${subscriber_id}
|
|
q: '2'
|
|
expires: '2019-09-03 12:00:00'
|
|
retain:
|
|
subscriberregistrations_path5: header.location
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#create subscriberregistrations with q < -1
|
|
-
|
|
name: create subscriberregistrations with q < -1
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_5
|
|
subscriber_id: ${subscriber_id}
|
|
q: '-2'
|
|
expires: '2019-09-03 12:00:00'
|
|
retain:
|
|
subscriberregistrations_path5: header.location
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#create subscriberregistrations without q
|
|
-
|
|
name: create subscriberregistrations without q
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_5
|
|
subscriber_id: ${subscriber_id}
|
|
expires: '2019-09-03 12:00:00'
|
|
retain:
|
|
subscriberregistrations_path5: header.location
|
|
conditions:
|
|
is:
|
|
code: 201
|
|
|
|
#create subscriberregistrations without expires
|
|
-
|
|
name: create subscriberregistrations without expires
|
|
type: item
|
|
method: POST
|
|
path: '/api/subscriberregistrations/'
|
|
header:
|
|
Content-Type: application/json
|
|
content:
|
|
contact: test_6
|
|
subscriber_id: ${subscriber_id}
|
|
q: '0.5'
|
|
retain:
|
|
subscriberregistrations_path6: header.location
|
|
conditions:
|
|
is:
|
|
code: 422
|
|
|
|
#DELETE subscriberregistrations
|
|
-
|
|
name: DELETE subscriberregistrations
|
|
type: item
|
|
method: DELETE
|
|
path: '/${subscriberregistrations_path5}'
|
|
conditions:
|
|
is:
|
|
code: 204 |