6 or do { plan 'skip_all' => 'Put your URL in the t/URL file to test'; exit };
7 chomp( my $URL = scalar(<URL>) );
9 plan tests => 6 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
11 use Net::Indosoft::Voicebridge;
13 my $vb = new Net::Indosoft::Voicebridge( 'url' => $URL );
19 $return = $vb->addAccount(
20 'account_name' => 'aname', #i think this is more like a username
21 'account_password' => 'test54',
23 'account_desc' => 'A test account',
25 'account_addr' => '1234 Test Lane',
26 'account_city' => 'Testville',
27 'account_state' => 'CA',
28 'account_zip' => '54321',
29 'account_country' => 'US',
31 'account_phone' => '415-555-1212',
32 # 'account_fax' => '415-555-1212',
33 'account_email' => 'ivan-voicebridge-test@freeside.biz',
36 ok( ! $return->{error}, 'addAccount successful' ) or warn $return->{error};
38 like($return->{account_id}, qr/^(\d+)$/, 'addAccount returned account_id');
40 my $account_id = $return->{account_id};
42 $return = $vb->addAccount(
45 ok( $return->{error}, 'addAccount empty error test', );
47 like($return->{error}, qr/Please, fill in/, 'addAccount empty error test got expected error');
49 $return = $vb->addAccount(
50 #'account_name' => 'A. Name',
51 'account_desc' => 'A test account',
52 'account_addr' => '1234 Test Lane',
53 'account_city' => 'Testville',
54 'account_state' => 'CA',
55 'account_zip' => '54321',
56 #'account_phone' => '415-555-1212',
57 'account_fax' => '415-555-1212',
58 #'account_email' => 'ivan-voicebridge-test@freeside.biz',
59 #'account_password' => 'testing',
62 ok( $return->{error}, 'addAccount bad data error test', );
64 like($return->{error}, qr/Please, fill in/, 'addAccount bad data error test got expected error');
68 $return = $vb->modifyAccount(
69 'account_id' => $account_id,
70 'account_name' => 'anewname', #i think this is more like a username
71 'account_password' => 'test32',
73 'account_desc' => 'A modified test account',
75 'account_addr' => '5432 Test Lane',
76 'account_city' => 'Test City',
77 'account_state' => 'NY',
78 'account_zip' => '12345',
79 'account_country' => 'US',
81 'account_phone' => '212-555-1212',
82 'account_fax' => '212-555-1212',
83 'account_email' => 'ivan-voicebridge-test2@freeside.biz',
86 ok( ! $return->{error}, 'modifyAccount successful' ) or warn $return->{error};
88 is($return->{account_id}, $account_id, 'modifyAccount returned account_id');
92 $return = $vb->addClient(
93 'account_id' => $account_id,
95 'client_contact_name' => 'Tofu Beast',
96 'client_contact_password' => 'word54',
98 'client_contact_addr' => '5432 Test Lane Suite 11',
99 'client_contact_city' => 'Test City',
100 'client_contact_state' => 'NY',
101 'client_contact_country' => 'US',
102 'client_contact_zip' => '12345',
104 'client_contact_phone' => '212-555-1234',
105 'client_contact_fax' => '212-555-1234',
106 'client_contact_email' => 'ivan-voicebridge-test3@freeside.biz',
110 ok( ! $return->{error}, 'addClient successful' ) or warn $return->{error};
112 like($return->{client_id}, qr/^(\d+)$/, 'addClient returned client_id');
114 my $client_id = $return->{client_id};
118 $return = $vb->modifyClient(
119 'account_id' => $account_id,
120 'client_id' => $client_id,
122 'client_contact_name' => 'Secret Agent X',
123 'client_contact_password' => 'word32',
125 'client_contact_addr' => '1234 Test Lane Suite 55',
126 'client_contact_city' => 'Testville',
127 'client_contact_state' => 'CA',
128 'client_contact_country' => 'US',
129 'client_contact_zip' => '54321',
131 'client_contact_phone' => '415-555-1234',
132 'client_contact_fax' => '415-555-1234',
133 'client_contact_email' => 'ivan-voicebridge-test4@freeside.biz',
137 ok( ! $return->{error}, 'modifyClient successful' ) or warn $return->{error};
139 is($return->{client_id}, $client_id, 'modifyClient returned client_id');
143 $return = $vb->addConference(
144 'client_id' => $client_id,
145 'conference_name' => 'Test Conference',
146 'conference_desc' => 'Net Indosoft Voicebridge test',
147 'start_time' => '2010-20-04 16:20:00',
148 #'moderated_flag' => 0,
149 #'entry_ann_flag' => 0
152 #'talk_detect_flag' => 0
153 #'play_user_cnt_flag' => 0
154 #'wait_for_admin' => 0
155 #'stop_on_admin_exit' => 0
157 #'secondary_pin' => 0,
158 #'allow_sub-conf' => 0,
160 #'conference_type' => 'reservation', #'reservationless',
164 ok( ! $return->{error}, 'addConference successful' ) or warn $return->{error};
166 like($return->{conference_id}, qr/^(\d+)$/, 'addConference returned conference_id');
168 my $conference_id = $return->{conference_id};
170 # modifyConference (2)
172 $return = $vb->modifyConference(
173 'conference_id' => $conference_id,
174 'conference_name' => 'Modified Test Conference',
175 'conference_desc' => 'Net Indosoft Voicebridge modify test',
176 'start_time' => '2010-20-04 16:20:00',
177 'moderated_flag' => 1,
178 #'entry_ann_flag' => 0
181 #'talk_detect_flag' => 0
182 #'play_user_cnt_flag' => 0
183 'wait_for_admin' => 1
184 #'stop_on_admin_exit' => 0
186 #'secondary_pin' => 0,
187 #'allow_sub-conf' => 0,
189 #'conference_type' => 'reservation', #'reservationless',
193 ok( ! $return->{error}, 'modifyConference successful' ) or warn $return->{error};
195 is($return->{conference_id}, $conference_id, 'modifyConference returned conference_id')
196 or warn $return->{'return'};
198 # deleteConference (2)
200 $return = $vb->deleteConference(
201 'conference_id' => $conference_id,
204 ok( ! $return->{error}, 'deleteConference successful' )
205 or warn $return->{error}. "\n". $return->{return}. "\n";
209 local $TODO = 'deleteConference always returns "Deleted successfully", even when nothing was';
211 $return = $vb->deleteConference(
212 'conference_id' => '999999999',
215 ok( $return->{error}, 'deleteConference bad data error test' )
216 ;#or warn $return->{return};
222 $return = $vb->deleteClient(
223 'client_id' => $client_id,
226 ok( ! $return->{error}, 'deleteClient successful' )
227 or warn $return->{error}. "\n". $return->{return}. "\n";
231 local $TODO = 'deleteClient always returns "Deleted successfully", even when nothing was';
233 $return = $vb->deleteClient(
234 'client_id' => '999999999',
237 ok( $return->{error}, 'deleteClient bad data error test' )
238 ;#or warn $return->{return};
244 $return = $vb->deleteAccount(
245 'account_id' => $account_id,
248 ok( ! $return->{error}, 'deleteAccount successful' )
249 or warn $return->{error}. "\n". $return->{return}. "\n";
253 local $TODO = 'deleteAccount always returns "Deleted successfully", even when nothing was';
255 $return = $vb->deleteAccount(
256 'account_id' => '999999999',
259 ok( $return->{error}, 'deleteAccount bad data error test' )
260 ;#or warn $return->{return};