Change-Id: Ia568d7a752fd9c1f32ebd81b7a2c909cccb99449changes/55/10355/2
parent
c31e254486
commit
207517408a
@ -0,0 +1,62 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::Collection;
|
||||
use Test::FakeData;
|
||||
use Test::More;
|
||||
use Data::Dumper;
|
||||
|
||||
#init test_machine
|
||||
my $test_machine = Test::Collection->new(
|
||||
name => 'customers',
|
||||
);
|
||||
$test_machine->methods->{collection}->{allowed} = {map {$_ => 1} qw(GET HEAD OPTIONS POST)};
|
||||
$test_machine->methods->{item}->{allowed} = {map {$_ => 1} qw(GET HEAD OPTIONS PUT PATCH)};
|
||||
|
||||
my $fake_data = Test::FakeData->new;
|
||||
$fake_data->set_data_from_script({
|
||||
'customers' => {
|
||||
'data' => {
|
||||
status => 'active',
|
||||
contact_id => sub { return shift->get_id('customercontacts',@_); },
|
||||
billing_profile_id => sub { return shift->get_id('billingprofiles',@_); },
|
||||
max_subscribers => undef,
|
||||
external_id => 'api_test customer'.time(),
|
||||
type => 'pbxaccount',#sipaccount
|
||||
'invoice_template_id' => sub { return shift->get_id('invoicetemplates',@_); },
|
||||
'subscriber_email_template_id' => sub { return shift->get_id('emailtemplates',@_); },
|
||||
'passreset_email_template_id' => sub { return shift->get_id('emailtemplates',@_); },
|
||||
'invoice_email_template_id' => sub { return shift->get_id('emailtemplates',@_); },
|
||||
},
|
||||
'query' => ['external_id'],
|
||||
'no_delete_available' => 1,
|
||||
},
|
||||
});
|
||||
|
||||
SKIP:{
|
||||
my ($res,$req,$content);
|
||||
#ew don't have POST fro the invoice templates
|
||||
my $invoicetemplate = $test_machine->get_item_hal('invoicetemplates','/api/invoicetemplates/?name=api_test');
|
||||
|
||||
if(!$invoicetemplate->{total_count} ){
|
||||
skip("Testing requires at least one present callforward. No creation is available.",1);
|
||||
}
|
||||
$fake_data->data->{customers}->{data}->{invoice_template_id} = $invoicetemplate->{content}->{id};
|
||||
#for item creation test purposes /post request data/
|
||||
$test_machine->DATA_ITEM_STORE($fake_data->process('customers'));
|
||||
|
||||
$test_machine->form_data_item( );
|
||||
# create 3 new sound sets from DATA_ITEM
|
||||
$test_machine->check_create_correct( 1, sub{ $_[0]->{external_id} .= $_[1]->{i}; } );
|
||||
$test_machine->check_bundle();
|
||||
}
|
||||
|
||||
|
||||
$fake_data->clear_test_data_all();
|
||||
$test_machine->clear_test_data_all();
|
||||
undef $fake_data;
|
||||
undef $test_machine;
|
||||
|
||||
done_testing;
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,42 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::Collection;
|
||||
use Test::FakeData;
|
||||
use Test::More;
|
||||
use Data::Dumper;
|
||||
|
||||
#init test_machine
|
||||
my $test_machine = Test::Collection->new(
|
||||
name => 'emailtemplates',
|
||||
);
|
||||
$test_machine->methods->{collection}->{allowed} = {map {$_ => 1} qw(GET HEAD OPTIONS POST)};
|
||||
$test_machine->methods->{item}->{allowed} = {map {$_ => 1} qw(GET HEAD OPTIONS PUT PATCH DELETE)};
|
||||
|
||||
my $fake_data = Test::FakeData->new;
|
||||
$fake_data->set_data_from_script({
|
||||
emailtemplates => {
|
||||
data => {
|
||||
reseller_id => sub { return shift->get_id('resellers',@_); },
|
||||
name => 'api_test_email_template_name',
|
||||
from_email => 'api_test@api-test.emal.com',
|
||||
subject => 'api_test email template',
|
||||
body => 'api_test email template: a lot of the text here',#0
|
||||
},
|
||||
'query' => ['name'],
|
||||
},
|
||||
});
|
||||
|
||||
#for item creation test purposes /post request data/
|
||||
$test_machine->DATA_ITEM_STORE($fake_data->process('emailtemplates'));
|
||||
|
||||
$test_machine->form_data_item( );
|
||||
# create 3 new sound sets from DATA_ITEM
|
||||
$test_machine->check_create_correct( 3, sub{ $_[0]->{name} .= $_[1]->{i}; } );
|
||||
$test_machine->check_get2put();
|
||||
$test_machine->check_bundle();
|
||||
$test_machine->clear_test_data_all();
|
||||
|
||||
done_testing;
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,39 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::Collection;
|
||||
use Test::FakeData;
|
||||
use Test::More;
|
||||
use Data::Dumper;
|
||||
|
||||
#init test_machine
|
||||
my $test_machine = Test::Collection->new(
|
||||
name => 'invoicetemplates',
|
||||
);
|
||||
$test_machine->methods->{collection}->{allowed} = {map {$_ => 1} qw(GET OPTIONS HEAD)};
|
||||
$test_machine->methods->{item}->{allowed} = {map {$_ => 1} qw(GET OPTIONS HEAD)};
|
||||
|
||||
my $fake_data = Test::FakeData->new;
|
||||
$fake_data->set_data_from_script({
|
||||
invoicetemplates => {
|
||||
data => {
|
||||
'reseller_id' => sub { return shift->get_id('resellers',@_); },
|
||||
'name' => 'api_test invoice template name'.time(),
|
||||
'type' => 'svg',
|
||||
'data' => 'api_test email template',
|
||||
},
|
||||
'query' => ['name'],
|
||||
},
|
||||
});
|
||||
|
||||
#for item creation test purposes /post request data/
|
||||
$test_machine->DATA_ITEM_STORE($fake_data->process('invoicetemplates'));
|
||||
|
||||
$test_machine->form_data_item( );
|
||||
# create 3 new sound sets from DATA_ITEM
|
||||
$test_machine->check_bundle();
|
||||
$test_machine->clear_test_data_all();
|
||||
|
||||
done_testing;
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
Loading…
Reference in new issue