|
|
|
@ -8,18 +8,6 @@ use Data::Dumper;
|
|
|
|
|
|
|
|
|
|
use NGCP::Panel::Utils::DateTime;
|
|
|
|
|
|
|
|
|
|
use Config::General;
|
|
|
|
|
my $catalyst_config;
|
|
|
|
|
my $panel_config;
|
|
|
|
|
for my $path(qw#/etc/ngcp-panel/ngcp_panel.conf etc/ngcp_panel.conf ngcp_panel.conf#) {
|
|
|
|
|
if(-f $path) {
|
|
|
|
|
$panel_config = $path;
|
|
|
|
|
last;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$panel_config //= 'etc/ngcp_panel.conf';
|
|
|
|
|
$catalyst_config = Config::General->new($panel_config);
|
|
|
|
|
my %config = $catalyst_config->getall();
|
|
|
|
|
|
|
|
|
|
#init test_machine
|
|
|
|
|
my $test_machine = Test::Collection->new(
|
|
|
|
@ -31,14 +19,13 @@ my $fake_data = Test::FakeData->new;
|
|
|
|
|
$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 $exp_type = $config{sip}{usrloc_expires_type} // '';
|
|
|
|
|
my $expires = $exp_type eq 'epoch' ? 0 : NGCP::Panel::Utils::DateTime::current_local();
|
|
|
|
|
my $expires = NGCP::Panel::Utils::DateTime::current_local();
|
|
|
|
|
|
|
|
|
|
$fake_data->set_data_from_script({
|
|
|
|
|
'subscriberregistrations' => {
|
|
|
|
|
data => {
|
|
|
|
|
'contact' => 'test',
|
|
|
|
|
'expires' => $exp_type eq 'epoch' ? $expires : $expires->ymd('-').' '.$expires->hms(':'),
|
|
|
|
|
'expires' => $expires->ymd('-') . ' ' . $expires->hms(':'),
|
|
|
|
|
'q' => 0.5,
|
|
|
|
|
'subscriber_id' => sub { return shift->get_id('subscribers', @_); },
|
|
|
|
|
},
|
|
|
|
|