diff options
| author | ivan <ivan> | 2009-02-26 15:28:31 +0000 |
|---|---|---|
| committer | ivan <ivan> | 2009-02-26 15:28:31 +0000 |
| commit | 57134b4a18772b114a5559a1f19d033b01291f62 (patch) | |
| tree | 0bc13709bb99f3b10d4589c383fba37852cfb737 /t | |
Diffstat (limited to 't')
| -rw-r--r-- | t/00-load.t | 9 | ||||
| -rw-r--r-- | t/01-Account_Client_Conference.t | 262 | ||||
| -rw-r--r-- | t/pod-coverage.t | 18 | ||||
| -rw-r--r-- | t/pod.t | 12 |
4 files changed, 301 insertions, 0 deletions
diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..860081a --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,9 @@ +#!perl -T + +use Test::More tests => 1; + +BEGIN { + use_ok( 'Net::Indosoft::Voicebridge' ); +} + +diag( "Testing Net::Indosoft::Voicebridge $Net::Indosoft::Voicebridge::VERSION, Perl $], $^X" ); diff --git a/t/01-Account_Client_Conference.t b/t/01-Account_Client_Conference.t new file mode 100644 index 0000000..21effd9 --- /dev/null +++ b/t/01-Account_Client_Conference.t @@ -0,0 +1,262 @@ +#!perl + +use Test::More; + +open URL, "t/URL" + or do { plan 'skip_all' => 'Put your URL in the t/URL file to test'; exit }; +chomp( my $URL = scalar(<URL>) ); + +plan tests => 6 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2; + +use Net::Indosoft::Voicebridge; + +my $vb = new Net::Indosoft::Voicebridge( 'url' => $URL ); + +my $return; + +# addAccount (6) + +$return = $vb->addAccount( + 'account_name' => 'aname', #i think this is more like a username + 'account_password' => 'test54', + + 'account_desc' => 'A test account', + + 'account_addr' => '1234 Test Lane', + 'account_city' => 'Testville', + 'account_state' => 'CA', + 'account_zip' => '54321', + 'account_country' => 'US', + + 'account_phone' => '415-555-1212', +# 'account_fax' => '415-555-1212', + 'account_email' => 'ivan-voicebridge-test@freeside.biz', +); + +ok( ! $return->{error}, 'addAccount successful' ) or warn $return->{error}; + +like($return->{account_id}, qr/^(\d+)$/, 'addAccount returned account_id'); + +my $account_id = $return->{account_id}; + +$return = $vb->addAccount( +); + +ok( $return->{error}, 'addAccount empty error test', ); + +like($return->{error}, qr/Please, fill in/, 'addAccount empty error test got expected error'); + +$return = $vb->addAccount( + #'account_name' => 'A. Name', + 'account_desc' => 'A test account', + 'account_addr' => '1234 Test Lane', + 'account_city' => 'Testville', + 'account_state' => 'CA', + 'account_zip' => '54321', + #'account_phone' => '415-555-1212', + 'account_fax' => '415-555-1212', + #'account_email' => 'ivan-voicebridge-test@freeside.biz', + #'account_password' => 'testing', +); + +ok( $return->{error}, 'addAccount bad data error test', ); + +like($return->{error}, qr/Please, fill in/, 'addAccount bad data error test got expected error'); + +# modifyAccount (2) + +$return = $vb->modifyAccount( + 'account_id' => $account_id, + 'account_name' => 'anewname', #i think this is more like a username + 'account_password' => 'test32', + + 'account_desc' => 'A modified test account', + + 'account_addr' => '5432 Test Lane', + 'account_city' => 'Test City', + 'account_state' => 'NY', + 'account_zip' => '12345', + 'account_country' => 'US', + + 'account_phone' => '212-555-1212', + 'account_fax' => '212-555-1212', + 'account_email' => 'ivan-voicebridge-test2@freeside.biz', +); + +ok( ! $return->{error}, 'modifyAccount successful' ) or warn $return->{error}; + +is($return->{account_id}, $account_id, 'modifyAccount returned account_id'); + +# addClient (2) + +$return = $vb->addClient( + 'account_id' => $account_id, + + 'client_contact_name' => 'Tofu Beast', + 'client_contact_password' => 'word54', + + 'client_contact_addr' => '5432 Test Lane Suite 11', + 'client_contact_city' => 'Test City', + 'client_contact_state' => 'NY', + 'client_contact_country' => 'US', + 'client_contact_zip' => '12345', + + 'client_contact_phone' => '212-555-1234', + 'client_contact_fax' => '212-555-1234', + 'client_contact_email' => 'ivan-voicebridge-test3@freeside.biz', + +); + +ok( ! $return->{error}, 'addClient successful' ) or warn $return->{error}; + +like($return->{client_id}, qr/^(\d+)$/, 'addClient returned client_id'); + +my $client_id = $return->{client_id}; + +# modifyClient (2) + +$return = $vb->modifyClient( + 'account_id' => $account_id, + 'client_id' => $client_id, + + 'client_contact_name' => 'Secret Agent X', + 'client_contact_password' => 'word32', + + 'client_contact_addr' => '1234 Test Lane Suite 55', + 'client_contact_city' => 'Testville', + 'client_contact_state' => 'CA', + 'client_contact_country' => 'US', + 'client_contact_zip' => '54321', + + 'client_contact_phone' => '415-555-1234', + 'client_contact_fax' => '415-555-1234', + 'client_contact_email' => 'ivan-voicebridge-test4@freeside.biz', + +); + +ok( ! $return->{error}, 'modifyClient successful' ) or warn $return->{error}; + +is($return->{client_id}, $client_id, 'modifyClient returned client_id'); + +# addConference (2) + +$return = $vb->addConference( + 'client_id' => $client_id, + 'conference_name' => 'Test Conference', + 'conference_desc' => 'Net Indosoft Voicebridge test', + 'start_time' => '2010-20-04 16:20:00', + #'moderated_flag' => 0, + #'entry_ann_flag' => 0 + #'record_flag' => 0 + #'moh_flag' => 0 + #'talk_detect_flag' => 0 + #'play_user_cnt_flag' => 0 + #'wait_for_admin' => 0 + #'stop_on_admin_exit' => 0 + #'second_pin' => 0 + #'secondary_pin' => 0, + #'allow_sub-conf' => 0, + #'duration' => 0, + #'conference_type' => 'reservation', #'reservationless', + +); + +ok( ! $return->{error}, 'addConference successful' ) or warn $return->{error}; + +like($return->{conference_id}, qr/^(\d+)$/, 'addConference returned conference_id'); + +my $conference_id = $return->{conference_id}; + +# modifyConference (2) + +$return = $vb->modifyConference( + 'conference_id' => $conference_id, + 'conference_name' => 'Modified Test Conference', + 'conference_desc' => 'Net Indosoft Voicebridge modify test', + 'start_time' => '2010-20-04 16:20:00', + 'moderated_flag' => 1, + #'entry_ann_flag' => 0 + #'record_flag' => 0 + #'moh_flag' => 0 + #'talk_detect_flag' => 0 + #'play_user_cnt_flag' => 0 + 'wait_for_admin' => 1 + #'stop_on_admin_exit' => 0 + #'second_pin' => 0 + #'secondary_pin' => 0, + #'allow_sub-conf' => 0, + #'duration' => 0, + #'conference_type' => 'reservation', #'reservationless', + +); + +ok( ! $return->{error}, 'modifyConference successful' ) or warn $return->{error}; + +is($return->{conference_id}, $conference_id, 'modifyConference returned conference_id') + or warn $return->{'return'}; + +# deleteConference (2) + +$return = $vb->deleteConference( + 'conference_id' => $conference_id, +); + +ok( ! $return->{error}, 'deleteConference successful' ) + or warn $return->{error}. "\n". $return->{return}. "\n"; + +TODO: { + + local $TODO = 'deleteConference always returns "Deleted successfully", even when nothing was'; + + $return = $vb->deleteConference( + 'conference_id' => '999999999', + ); + + ok( $return->{error}, 'deleteConference bad data error test' ) + ;#or warn $return->{return}; + +} + +# deleteClient (2) + +$return = $vb->deleteClient( + 'client_id' => $client_id, +); + +ok( ! $return->{error}, 'deleteClient successful' ) + or warn $return->{error}. "\n". $return->{return}. "\n"; + +TODO: { + + local $TODO = 'deleteClient always returns "Deleted successfully", even when nothing was'; + + $return = $vb->deleteClient( + 'client_id' => '999999999', + ); + + ok( $return->{error}, 'deleteClient bad data error test' ) + ;#or warn $return->{return}; + +} + +# deleteAccount (2) + +$return = $vb->deleteAccount( + 'account_id' => $account_id, +); + +ok( ! $return->{error}, 'deleteAccount successful' ) + or warn $return->{error}. "\n". $return->{return}. "\n"; + +TODO: { + + local $TODO = 'deleteAccount always returns "Deleted successfully", even when nothing was'; + + $return = $vb->deleteAccount( + 'account_id' => '999999999', + ); + + ok( $return->{error}, 'deleteAccount bad data error test' ) + ;#or warn $return->{return}; + +} diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100644 index 0000000..fc40a57 --- /dev/null +++ b/t/pod-coverage.t @@ -0,0 +1,18 @@ +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" + if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.18; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" + if $@; + +all_pod_coverage_ok(); @@ -0,0 +1,12 @@ +#!perl -T + +use strict; +use warnings; +use Test::More; + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); |
